1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
public JComboBox createComboBox(final String name, final LinkedList<JComboBox> list) {
if(name==null || list == null) return null;
final JComboBox box = new JComboBox();
box.setName(name);
box.setSelectedIndex(-1);
box.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
System.out.println("lost WHERE "+name+" = "+box.getSelectedItem().toString());
for(int i = 0;i<list.size();i++) {
list.get(i).setSelectedIndex(box.getSelectedIndex());
}
//updateUI();
}
});
return box;
} |