Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

drop down multiple selection

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic