|
It is funny, because if I run this code
public void popUp() {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add(new JMenuItem("test1"));
popupMenu.add(new JMenuItem("test2"));
popupMenu.show(EC_GUI.main.getGlViewer().getNewtCanvasAWT(), 10, 10);
popupMenu.setVisible(true);
}
The popup is working, that is if I move the mouse over a menuItem it gets selected and if I click somewhere else it disappears
But if I run this code from the MouseListener
try{
int x = me.getX();
int y = me.getY();
if (me.getModifiers()==MouseEvent.BUTTON3_MASK)
{
EC_GUI.main.hub.popUp(x, y);
}
}catch(Throwable ex)
{
ex.printStackTrace();
}
It gets stuck, that is no background selection on items, no disappearing if clicking somewhere else
Often the application doesnt answer anymore, but nothing I do not get any exception on the console output
Why?
|