I have x ports in my computer. I woud like to add to menu any device is plug into and recive user input for listener. I wrote:
private void portSelectItem(){
JMenu port=new JMenu("Port");
String[] portTab= SerialIO.listPorts();
for(String s : portTab){
port.add(new JCheckBoxMenuItem(s));
}
}
With way I generate dynamical x references and add listener in this ports?