Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JPopupMenu and UseScreenMenuBar



2008/9/3 Brian Cabana <email@hidden>
Hi Gents,

I am writing a multi-platform application where I popup JPopupMenus from a button in a frame's toolbar.  In Windows, the popup is dismissed when I click on a menu item in the menu bar.  However in OSX with the useScreenMenuBar set to true, the popup is no longer dismissed when I open a menu from the screen menu. The popup eventually gets dismissed as a result of a menu item selection change notification.
I set a breakpoint where the JPopupMenu is dismissed and found that on Windows, the popup is dismissed by an AWTEventListener in javax.swing.plaf.BasicPopupMenuUI.  This same AWTEventListener is not notified when a mouse pressed occurs in the screen menu bar.
If you're using useScreenMenuBar with Aqua LaF (with any other LaF menubar outside of the application will not work anyway) then the right class would be apple.laf.CUIAquaPopupMenu (depends on the java version, UIManager.get("PopupMenuUI") will help).
Is there a way to get notified of events in the screen menu bar, specifically mouse events?
Dunno how about events in screen menu bar but one possible way would be to go throw your JMenu's and addMenuListener(...); to it. In menuSelected() you could hide your PopupMenu's.

--
vi is [[13~^[[15~^[[15~^[[19~^[[18~^ a
muk[^[[29~^[[34~^[[26~^[[32~^ch better editor than this emacs. I know
I^[[14~'ll get flamed for this but the truth has to be
said. ^[[D^[[D^[[D^[[D ^[[D^[^[[D^[[D^[[B^
exit ^X^C quit :x :wq dang it :w:w:w :x ^C^C^Z^D
-- seen on alt.religion.emacs

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >JPopupMenu and UseScreenMenuBar (From: "Brian Cabana" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.