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:
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.