Reputation: 377
I've created a JComboBox
and when I choose an option from the combo box I want to add another combo box (for choosing more specific details) for the selected option. Is this possible?
I've tried creating another JComboBox
in the original combo box's actionPerformed
class, but I didn't solve the problem.
The result should look something like this:
Upvotes: 0
Views: 401
Reputation: 53
Regarding adding a new JComboBox
: Rather than actionPerformed
try with JComboBox.addItemListener(ItemEvent)
. This is the right place to get the selected item and therefore to create and populate a new JComboBox
with details you want to include.
Here a link to a demo project in GitHub
Upvotes: 1