Results 1 to 3 of 3
Thread: JMenuBar and Popups
- 12-09-2010, 05:56 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 7
- Rep Power
- 0
JMenuBar and Popups
Hi all,
Hope you can help with this as I'm out of idea's on how to achieve it.
I have a small app with a JMenuBar, a number of JMenu's which contain a number of JMenuItems, all very straightforward so far.
The default behaviour of any JMenu is to appear within a popup below the JMenuBar item that has been selected but what I'm trying to do it to change this default functionality.
I am trying to reposition the JMenu popup to another position on the screen relative to the JMenuBar button selected. For instance I would like to position it 100 pixels lower than it is by default.
I would prefer however not to do this by simply creating an action listener and reponding to say a mouse event. I have done something similiar for a JCombo box by replacing it's UI delegate and overriding the "createPopup()" method and dynamically repositioning the popup it creates from there. I'm looking for suggestions/examples of something similiar if anyone has any idea.
Thanks again.
- 12-10-2010, 05:49 AM #2
Member
- Join Date
- Nov 2010
- Posts
- 4
- Rep Power
- 0
Use a MenuListener. The menuSelected(MenuEvent) method is called before the popup is made visible, so you can request the popup's location by calling setMenuLocation(x, y) on the JMenu within said method.
- 12-10-2010, 10:07 AM #3
Member
- Join Date
- Dec 2010
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
Annoying Popups
By camickr in forum Suggestions & FeedbackReplies: 24Last Post: 03-01-2011, 03:58 PM -
Mutliple JMenuBar
By chyrl in forum AWT / SwingReplies: 10Last Post: 11-04-2010, 05:43 AM -
Changing position of JMenuBar
By LianaN in forum New To JavaReplies: 8Last Post: 09-17-2010, 12:41 PM -
JMenubar option
By navishkumarb in forum New To JavaReplies: 3Last Post: 05-24-2010, 02:03 AM -
Create JMenuBar using DataBase
By arulmozs in forum AWT / SwingReplies: 1Last Post: 11-03-2009, 11:52 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks