You again ??!!! Buy "Java Swing" published by O'Reilly, thats where I learnt my Swing - its a great book with loads of adaptable code examples !
Right then - JComboBox listeners :
In your class somewhere, you initialise your ComboBox's :
///////
JComboBox myComboBox = new JComboBox();
JComboBox myComboBox2 = new JComboBox();
////////////
///and make this variable visible form anywhere in your code
int whatEverSelected = 0;
/////// then later in code, the actionevent listener method :
public void actionPerformed(ActionEvent e) {
Object comboChooser = ((JComboBox)e.getSource());
if (comboChooser == myComboBox) {
System.out.println(((String)((JComboBox)e.getSource()).getSelectedItem()));
whatEverSelected = 1; //register what was clicked so you can do stuff with it later with second combobox
//do some other stuff
}
if (comboChooser == myComboBox2 && whatEverSelected == 1) {
System.out.println(((String)((JComboBox)e.getSource()).getSelectedItem()));
//do some other stuff
whatEverSelected = 0; //reset this var
}
}
This will listen for clicks on the exact item selected in the first combobox, and also register with the variable 'whatEverSelected' what happened when the user clicked an item in the first. So when the user clicks an item in the second jcombobox, if a given item in the first was clicked earlier, then the go-ahead is OK to do whatever with the following code ....
I hope this makes sense, obviously you would have to find a less simple variable than 'whatEverSelected', but the idea remains the same, form a code-perspective.
I've had a couple of beers tonight, so if this makes no sense, then gives me a shout and I'll try to clarify !!!