This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes drop down multiple selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "drop down multiple selection" Watch "drop down multiple selection" New topic

drop down multiple selection

andy keidel

Joined: Mar 01, 2004
Posts: 5
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

Joined: Oct 18, 2000
Posts: 4121

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.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: drop down multiple selection