Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Eclipse Collections Categorically: Level up your programming game
this week in the
Open Source Projects
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
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Swing / AWT / SWT
How add JLabels as headers for JPopupMenu's menuitem sections?
Dan Bizman
Ranch Hand
Posts: 387
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I know that menuitems in a JPopupmenu can be separated by addSeparator(), but I also want to be able to set headers/titles for those sections. So you'd get something like:
FILE OPTIONS
- Open File
- Delete File
PROPERTY OPTIONS
- Rename
- View Properties
Is there a way to do this?
Dan Bizman
Ranch Hand
Posts: 387
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is this possible? Or do I have to extend JPopupMenu
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I don't know of anyway of going that without rolling your own, other than possibly adding a JMenuItem that doesn't have an action attached to it.
Tim LeMaster
Ranch Hand
Posts: 226
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You mean like this?
JPopupMenu popMenu = new JPopupMenu(); popMenu.add(new JLabel("FILE OPTIONS")); popMenu.add(new JMenuItem("- Open File")); popMenu.add(new JMenuItem("- Delete File")); popMenu.add(new JLabel("PROPERTY OPTIONS")); popMenu.add(new JMenuItem("- Rename")); popMenu.add(new JMenuItem("- View Properties"));
No, tomorrow we rule the world! With this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Preventing JS from Cache
How to write JTable in Excel sheet?
how to set the download mode
How to set the content type for a GET request from a browser
PE file
More...