Results 1 to 2 of 2
Thread: Link between JComboBox variables
- 10-13-2010, 04:34 PM #1Member
- Join Date
- Oct 2010
- Rep Power
Link between JComboBox variables
I want to create multiple dorpdownlists in a JApplet.
Dropdownlist A, containing: A1, A2, A3
Dropdownlist B, containing: B1, B2, B3
Dropdownlist C, containing: C1, C2, C3
What I want to create, is that when I select A1 in Dropdownlist A, list B and C automatically show B1 and C1. The same when I select B2, list A and C automatically show A2 and C2. etc...
How should I do this? I think I need to declare JComboBoxes for the dropdownlist right? But how about the automatic selection "Link" between the dropdown lists? What kind of listeners are needed for this? And do I need to make use of the repaint method or something to automatically refresh the JApplet with all new items in de dropdown lists?
- 10-13-2010, 06:15 PM #2
Read the API for JComboBox and follow the link to the Swing tutorial on How to Use Combo Boxes, where you will find the answers to your questions. Once you have some code that attempts to meet the requirement, feel free to ask a specific question about any problems.
If you do it correctly, you won't have any need to call repaint().
- By rajivjoshi in forum New To JavaReplies: 3Last Post: 05-31-2010, 11:10 AM
- By bahumbaba in forum AWT / SwingReplies: 2Last Post: 12-10-2009, 02:58 PM
- By sandeshforu in forum New To JavaReplies: 3Last Post: 09-09-2009, 06:48 PM
- By aparna in forum New To JavaReplies: 0Last Post: 03-19-2008, 03:15 PM
- By one198 in forum New To JavaReplies: 0Last Post: 10-14-2007, 02:33 PM