wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes How.....change combobox1 value ....combobox2 contain value related to that.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How.....change combobox1 value ....combobox2 contain value related to that.... " Watch "How.....change combobox1 value ....combobox2 contain value related to that.... " New topic
Author

How.....change combobox1 value ....combobox2 contain value related to that....

sandhiya sindhi
Ranch Hand

Joined: Sep 25, 2003
Posts: 50
Hi All,
when i select one value in Combobox than second combobox contains the value related to the first one combobox value selection.
kindly help me... i have searched Api but i didnt find..
Thanks in advance
[ November 07, 2003: Message edited by: sandhiya Laghari ]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Moved to the Swing forum.


"JavaRanch, where the deer and the Certified play" - David O'Meara
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
Hi Sandhya,
From your description, what I understood is there are 2 comboboxes, and when you select an item in Ist Combobox, you have to select an item in the other one - right..
If so, add an ItemListener to the Ist Combobox, and in itemStateChanged(), write your logic to select the corresponding item in the second Combobox.
sandhiya sindhi
Ranch Hand

Joined: Sep 25, 2003
Posts: 50
Dear Vijay
i want to do this:

Now when i select numbers in first combobox than combo2 contain array of numbers.
yes through actionListener but how..
thanx for help
Richa Goyal
Greenhorn

Joined: Aug 26, 2001
Posts: 18
Dear Sandhya
In action performed event use
if (String) combo1.getSelectedItem()=="numbers" then
combo2.add(array1())
else
combo2.add(array2())
or you can also use getSelectedIndex method of comboboxes which return an integer value starting index value from 0.
Richa.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How.....change combobox1 value ....combobox2 contain value related to that....
 
Similar Threads
Jsp
combobox value is not changing
how to display data from db in textbox according to data selected in combobox in jsp
How to get the previously selected value in the combo box ?
Comboboxes in a jsp page.