The part that I'm having a hard time on is the JComboBoxes and how to create them with all the changing values.
Here is my applet that I have so far (Far from done)
When you select on the top ComboBox it should load different ones in the second field. If everything works right the third one will get passed the correct value to show values there.
public void actionPerformed(ActionEvent e) {
//This whole method needs redone.
Object source = e.getSource();
if(source.equals(combo)){
// Changes the Calculator
calc = (String)combo.getSelectedItem();
calc2 = (String)page.getItemAt(1);
CalcBuild(calc, calc2);
}
if(source.equals(page)){
calc2 = (String)page.getSelectedItem();
CalcBuild(calc,calc2);
}
else if(source.equals(search)){
// Other code not pertaining to this
}
else{
JOptionPane.showMessageDialog(this, "Error Code: GUI490", "Error, please enter a username.", JOptionPane.INFORMATION_MESSAGE);
}
}
}
The right methods are getting called, it's just how I check the values of the ComboBoxes. If you want to view the whole source code you can download it here:
I didn't fully understand your question. I did, however, make an example in Java, which should hopefully clear up any questions you might have about changing the values of a JComboBox.
right I didn't really show you guys what the problem was. When you click on the top combo box at like 530, 3 it is suppose to load the middle combo box with values depending on what is in the top combo box.
There is the compiled version of it. Don't mind the JOptionBox I was using it to see what values are being passed through the action listener.
When you click Construction, in the top combo box, it should load up raw materials in the middle box and raw materials in the bottom box. If you click on garden in the 2nd tab once you are in construction in the top tab, it should load like 4 options in the bottom box.
I'll go through your posted code right now and see if that's the answer