Java MouseListener - Events

Does anyone know if the following expectations are expected in regards to being MouseEvent

fired? It seems like someone is missing or consumed elsewhere.

  • Right click on JPanel

    and show JPopupMenu

    :

    MousePressed java.awt.event.MouseEvent[MOUSE_PRESSED,
      (469,347),absolute(2214,490),button=3,modifiers=Meta+Button3,
      extModifiers=Button3,clickCount=1]
    
    MouseReleased java.awt.event.MouseEvent[MOUSE_RELEASED,
      (469,347),absolute(2214,490),button=3,modifiers=Meta+Button3,
      extModifiers=Meta,clickCount=1]
    
    MouseClicked java.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 the right order

  • C JPopupMenu

    is still showing left click somewhere in JPanel

    not in JPopupMenu

    :

    What happened to the event MousePressed

    ?

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

Thanks in Advance.

+1


a source to share


1 answer


So, the event that closes the popup menu is gone.

IIRC, exactly how it is implemented, has changed from 1.5 to 1.6. In 1.5 there is glass glass, in 1.6 AWTEventListener

. See sources for details BasicPopupMenuUI

. It looks like you can (globally) stop the event that is being consumed with:



UIManager.put("PopupMenu.consumeEventOnClose", false);

      

+2


a source







All Articles