This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How add JLabels as headers for JPopupMenu's menuitem sections? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "How add JLabels as headers for JPopupMenu Watch "How add JLabels as headers for JPopupMenu New topic
Author

How add JLabels as headers for JPopupMenu's menuitem sections?

Dan Bizman
Ranch Hand

Joined: Feb 25, 2003
Posts: 387
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

Joined: Feb 25, 2003
Posts: 387
Is this possible? Or do I have to extend JPopupMenu
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

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

Joined: Aug 31, 2006
Posts: 226
You mean like this?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How add JLabels as headers for JPopupMenu's menuitem sections?
 
Similar Threads
PE file
Preventing JS from Cache
how to set the download mode
How to write JTable in Excel sheet?
How to set the content type for a GET request from a browser