This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to change third level sub menu item position? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to change third level sub menu item position?" Watch "how to change third level sub menu item position?" New topic
Author

how to change third level sub menu item position?

ertan eyimaya
Greenhorn

Joined: Feb 16, 2005
Posts: 14
Hi,

I have a popup menu up to four level. Let's say : Aaaaaaa->Bbbbbbb->Ccccccc->Ddddddd

When mouse is right clicked at right bottom of the screen Popup menu is shown. If I move mouse on Aaaaaaa since no place for second level,
Bbbbbbb is shown at left of Aaaaaaa, then if I move mouse on Bbbbbbb then Ccccccc appears at right of Bbbbbbb. Problem is here,
I want Ccccccc is displayed left of Bbbbbbb and Ddddddd is at left of Ccccccc. All sub menus should opened towards left.

Note: This of course should be reverse when I right click at left bottom of screen. This time I want all submenus will be opened at right of it's parent.

thanks....
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4571
    
    5

The behavior you describe is the default behavior of submenus on pretty much all windowed systems. You can find the code that computes the desired screen location in the method getPopupMenuOrigin() of JMenu.java.

If this is important enough to you, you could try extending JMenu to obtain the desired behavior. Won't be easy though -- that method is 120 lines long.


luck, db
There are no new questions, but there may be new answers.
ertan eyimaya
Greenhorn

Joined: Feb 16, 2005
Posts: 14
thanks for your reply. I'll try it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to change third level sub menu item position?