Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JComboBox that is a Menu

I'm looking to create a JComboBox that acts as a menu. For example, when you drop it down, you can select items like you would in a JMenuBar.

So it would take JMenus and JMenuItems as instead of Strings.

Is this possible?

like image 205
user489041 Avatar asked Nov 14 '22 01:11

user489041


1 Answers

One way to accomplish this would be to create a button that when clicked shows a JPopupmenu, just below the button. The menu would allow the user to select from the menu or submenu. The label/selection of the original button should be changed when a menu item is selected.

like image 79
jzd Avatar answered Dec 17 '22 19:12

jzd