Java popup trigger on Linux

I have an application in which you can right-click and drag (as well as left-click and drag for different operations). However, when running this on linux, it seems that the pop-up menus are started with the mouse, not the mouse. This leads to the fact that every time I click the right mouse button to perform a drag, pop-up menus are launched (unlike the windows where the mouse is located).

Any thoughts on how to get around this?

thanks.

EDIT: Code Posting

Code for popup menu

// this is called from mousePressed and mouseReleased if (e.isPopupTrigger() && !e.isConsumed()) { // show the popup menu } 

This code is what gets called when right-clicking / dragging (this is third-party code, but it is open source, so I can change it as needed)

 // this is called on all mouse events if (buttonAction.mouseButton != 0) { // handle the event } 
+8
java linux popup
source share
3 answers

Yes, use isPopupTrigger() as shown here .

Application:

appears isPopupTrigger runs on mousePressed in linux.

Yes, this is the same on Mac OS X. You should call isPopupTrigger() from mousePressed() and mouseReleased() . Here is an example given in GraphPanel .

+11
source share

MouseEvent.isPopupTrigger (). Returns whether this mouse event is a platform popup menu trigger event.

edit -: you need to check both in mousePressed for linux and in mouseReleased for Windows.

+1
source share

I think the correct procedure in your case should be to combine where and when to show the popup. As a drag event, if one exists, there follows a press event, which you should avoid logic logic to display a pop-up window in a press event (and then also write logic in an event to display a pop-up window). Some users feel good looking at the pop-up while holding the pop-up button, and some other users are simply not interested or do not know. But in your case, you will not be able to navigate the pop-up menu when dragging and dropping without adding additional code.

Can we control the logic to always show a popup in the release event. Entering the release event after drag and drop should be sufficient to know that the popup should not be visible. And, of course, always, if you can change and change the source.

0
source share

All Articles