I'm working on a tool (ArduBlock) which give a graphical programming environment for arduino.
I would like to display these informations on the JFrame of this tool :
the name of the selected board
the name of the selected serial port
It's OK for the name of the selected board : an itemStateChanged listener on the board menu does the job.
But this method has no effect with the serial port menu. I can create a listener, i can get it, but it haven't any reaction when the serial port is modified.
No, the user select the serial port from the tool/serial port/COM1, COM2, ... menu of the arduino EDI.
And so i want my adding tool (ArduBlock) to detct any modification of serial port and display it.
palary18:
No, the user select the serial port from the tool/serial port/COM1, COM2, ... menu of the arduino EDI.
And so i want my adding tool (ArduBlock) to detct any modification of serial port and display it.
Can you explain more clearly what your tool is intended to do?
For example, if the User is using the Arduino IDE to connect to an Arduino board I don't see how another program can do so at the same time with the same COM serial port.
My program is an addon to Arduino EDI. It is build as a tool for processing :
In the addon, this java instruction is OK for listening a board choice :
itemRB.addActionListener(this);
where itemRB is pointing to the radio buttons "arduino uno", ..., "arduino BT", ..., "arduino leonardo", ... from the board menu.
but this one don't work for listening a serial port choice :
itemCB.addActionListener(this);
where itemCB is pointing to the check boxes "COM1", "COM2", ... from the serial port menu.
You can see ardublock blog for more explanation about it.
My wish is to show in real time the board name and the serial port on my addon. Like this :
the addon is programmed in java language. I can access to the arduino "editor" class, so my program can implement menu listeners. those relating to the choice of the board are active, but those affecting the serial ports do not respond.
public void run() {
try {
...
final JRadioButtonMenuItem itemRB = (JRadioButtonMenuItem)menu.getItem(i);
itemRB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//// it's OK
//// i can read the selected board
//// so i can actualize the nale of the board on the addon Frame
}
...
final JCheckBoxMenuItem itemCB = (JCheckBoxMenuItem)menu.getItem(i);
itemRB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//// it's not OK
//// this listener is never fired
//// and no discount is possible
}
...
}
if somebody is interested, that's the solution :
everytime that the tool menus are selected, arduino updates the sub port menu and also the action listeners attached. So i must do the same in my addon.