aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
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
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

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.


GenRocket - A Test Data Generation Platform
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
how to set the download mode
PE file
How to write JTable in Excel sheet?
Preventing JS from Cache
How to set the content type for a GET request from a browser