Help with Java...

SinNisTeR

Diamond Member
Jan 3, 2001
3,570
0
0
I'm working on a little project and im trying to do something like this here. Where you select an item on a drop down menu and the menu under changes.

Example.

select component: options { cpu, motherboard, ram, video card }

if the user selects a cpu, then the jcombobox under will have the options { amd, intel }

and so on...

this is what i have so far:
 

TerryMathews

Lifer
Oct 9, 1999
11,464
2
0
Instead of using the JComboBox.getSelectedItem(), why not addActionListener() to the JComboBox items in the list before you add them, then in the member where you handle your actions, do something like this:

if(evt.getSource() == "Intel")
{JComboBox2.addItem("p4");}
else if(evt.getSource() == "AMD")
{JComboBox2.addItem("athlonxp");}

Note this is not necessairly correct Java syntax, but should get you on the right path.
 

SinNisTeR

Diamond Member
Jan 3, 2001
3,570
0
0
this is how i have the jcomboboxes setup:

I dont know of anyway to have the actionlistener be linked to a text option.

I setup the actionlistener to the list itself. when it is clicked, i then proceed to see what option was clicked and base the following jcomboboxes to fit that selected item.