How do you hide JPopupMenu after the click of a mouse in another window?



  • There's my object. jPopupMenu for a particular event when the user claws the right button in the table (JTable) We need to cover it if the user clicks outside the menu and table area of any button or shows it elsewhere if the user clicks right button.

    Well, it's just that I'm changing the location. And if it's already open, I can hide it on the condition that the table is clicked. How do you hide if the click user is on the annex window?



  • We need an application window to inherit the class. WindowAdapterYou need the method:

    public void windowActivated(WindowEvent e)
    {
    ...
    }
    

    Processing the events when the window is activated, there's something like popupMenu.setVisible(false); Or how you have a code.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2