views:

462

answers:

1

Does any know if the following is the expected behaviors in terms of what MouseEvents are fired? One seems to be missing or consumed elsewhere.

  1. Right-click on JPanel and display JPopupMenu

    MousePressedjava.awt.event.MouseEvent[MOUSE_PRESSED,(469,347),absolute(2214,490),button=3,modifiers=Meta+Button3,extModifiers=Button3,clickCount=1]

    MouseReleasedjava.awt.event.MouseEvent[MOUSE_RELEASED,(469,347),absolute(2214,490),button=3,modifiers=Meta+Button3,extModifiers=Meta,clickCount=1]

    MouseClickedjava.awt.event.MouseEvent[MOUSE_CLICKED,(469,347),absolute(2214,490),button=3,modifiers=Meta+Button3,extModifiers=Meta,clickCount=1]

    So far so good all 3 from button 3 and in correct order

  2. With JPopupMenu still showing left click somewhere in the JPanel not in the JPopupMenu

    --> WHAT HAPPENED TO THE MousePressed Event?
    MouseReleasedjava.awt.event.MouseEvent[MOUSE_RELEASED,(452,339),absolute(2197,482),button=1,modifiers=Button1,clickCount=1]

    MouseClickedjava.awt.event.MouseEvent[MOUSE_CLICKED,(452,339),absolute(2197,482),button=1,modifiers=Button1,clickCount=1] ]]

Thanks in Advance.

+2  A: 

So the event that causes the popup menu to close has disappeared.

IIRC, exactly how this is implemented changed from 1.5 to 1.6. In 1.5 there is a glasspane, in 1.6 AWTEventListeners are used. See BasicPopupMenuUI sources for details. It looks as if you can (globally) stop the event being consumed with:

UIManager.put("PopupMenu.consumeEventOnClose", false);
Tom Hawtin - tackline
Wouldn't that be "false" to stop the event from being consumed?
Software Monkey
Probably! I'll edit.
Tom Hawtin - tackline