* @param ev
*
* @see
*/
public void itemStateChanged(ItemEvent ev) {
ParallelPort port;
String sel = (String) ev.getItem();
int value = 0;
if (sel.equals("Any")) {
value = ParallelPort.LPT_MODE_ANY;
} else if (sel.equals("ECP")) {
value = ParallelPort.LPT_MODE_ECP;
} else if (sel.equals("EPP")) {
value = ParallelPort.LPT_MODE_EPP;
} else if (sel.equals("NIBBLE")) {
value = ParallelPort.LPT_MODE_NIBBLE;
} else if (sel.equals("PS2")) {
value = ParallelPort.LPT_MODE_PS2;
} else if (sel.equals("SPP")) {
value = ParallelPort.LPT_MODE_SPP;
} else {
this.showValue();
return;
}
port = this.owner.port;
if (port != null) {
/*
* Set the mode.
*/
try {
port.setMode(value);
} catch (UnsupportedCommOperationException e) {
System.out.println("Cannot set mode to " + sel + " for port "
+ port.getName());
}
}
this.owner.showValues();
}