Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drop down multiple selection

 
andy keidel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JComboBox doesn't support multiple selection. JMenu does. But JMenu seems to be designed only for going in JMenuBars, which are in the top section of the frame. Sure, you CAN put the JMenu/JMenuBar elsewhere, but it tends to look really bad in most LnFs.
So how can I get something in a random part of my JFrame that LOOKS nice like a JComboBox but allows MULTIPLE selection like a JMenu?
I don't want a JList, which doesn't drop down and looks like crap.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JComboBox doesn't support multiple selection because it doesn't make sense... the user selects one value from the popup list and then that one value is displayed in the closed combobox. How are you going to show that multiple values are selected?

I don't understand what you mean by JMenus support multiple selection (unless you are talking about using JCheckBoxMenuItems? ) Basically all a JMenu is is a JButton that launches a JPopupMenu containing the menu items that the menu contains... it's not like you can launch the File menu and select open through exit... you can only select one option at a time.

It sounds like you might get what you want by making a regular JButton that launches a JPopupMenu with JCheckBoxMenuItems in it, instead of using JMenu.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic