Results 1 to 6 of 6
- 12-01-2010, 04:13 PM #1Member
- Join Date
- Dec 2010
- Rep Power
Listening to JPopupMenu invocation
How can one listen to JPopupMenu invocation? I need to disable a JPopupmenu's JButton WHEN the JPopupMenu is invoked.
Please note that I do not need to listen to a JPopupMenu's menu items, but to the popupmenu's invocation i.e. I need to execute some code WHEN the jpopupmenu is invoked.
- 12-01-2010, 04:19 PM #2
This probably isn't perfect, but couldn't you add a MouseListener to the JPopupMenu?
Or you could extend JPopupMenu to extend one of the methods that are invoked upon popup: setVisible maybe, or menuSelectionChanged, or show? Or use a SelectionModel?
I'm just guessing, but those seem like solid places to start.
Last edited by KevinWorkman; 12-01-2010 at 04:21 PM.
- 12-02-2010, 06:36 AM #3
- 12-02-2010, 02:14 PM #4
- 12-03-2010, 05:51 AM #5Weird, that Listener is not mentioned in the "How to Use Menus" tutorial.
- 12-03-2010, 03:06 PM #6
- By kavithakr in forum Advanced JavaReplies: 1Last Post: 03-14-2009, 10:04 PM
- By hungleon88 in forum NetBeansReplies: 8Last Post: 01-15-2009, 06:00 PM
- By tanvij in forum New To JavaReplies: 0Last Post: 05-14-2008, 10:05 AM
- By rjuyal in forum Advanced JavaReplies: 4Last Post: 04-07-2008, 12:07 PM
- By Heather in forum JDBCReplies: 2Last Post: 06-12-2007, 05:33 PM