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.
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.
There are no new questions, but there may be new answers.
Joined: Feb 16, 2005
thanks for your reply. I'll try it.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: how to change third level sub menu item position?