Hi, many thanks for your reply. A super small app which demonstrates the problem is below. Right clicking on the canvas will display 3 cartoon character names. Don’t know whether the bug(feature?) would be the same on another os, because I’ve only tried it on linux. Please let me know. The right click menu only seems to come up when I right click near the bottom edge of the canvas. Any help appreciated.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.games.jogl.*;
public class PopupTest extends JFrame implements MouseListener, GLEventListener
{
GLCanvas canvas = null;
JPopupMenu popupMenu = new JPopupMenu("my menu");
public static final Dimension PREFERRED_FRAME_SIZE = new Dimension (400, 400);
public PopupTest()
{
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
GLCapabilities capabilities = new GLCapabilities();
canvas = GLDrawableFactory.getFactory().createGLCanvas(capabilities);
this.getContentPane().add (canvas, BorderLayout.CENTER);
this.getContentPane().add(canvas);
canvas.addGLEventListener(this);
canvas.addMouseListener(this);
// add test items to the popup menu
popupMenu.add(new JMenuItem("Micky Mouse"));
popupMenu.add(new JMenuItem("Donald Duck"));
popupMenu.add(new JMenuItem("Scooby Doo"));
//needed to make the menus display over GLCanvas
}
public Dimension getPreferredSize ()
{
return PREFERRED_FRAME_SIZE;
}
public static void main(String[] args)
{
PopupTest put = new PopupTest();
put.pack();
put.setVisible(true);
}
public void mouseExited(MouseEvent me) {}
public void mouseEntered(MouseEvent me) {}
public void mouseClicked(MouseEvent me) {}
public void mouseReleased(MouseEvent me)
{
if (me.isPopupTrigger() )
{
popupMenu.show(me.getComponent(), me.getX(), me.getY());
}
}
public void mousePressed(MouseEvent me)
{
if (me.isPopupTrigger())
{
popupMenu.show(me.getComponent(), me.getX(), me.getY());
}
}
public void displayChanged (GLDrawable drawable,boolean mc, boolean dc){}
public void init (GLDrawable drawable)
{
GL gl = drawable.getGL();
gl.glClearColor( 1.0f, 1.0f, 1.0f, 1.0f ); //white
gl.glClear (GL.GL_COLOR_BUFFER_BIT);
}
public void reshape (GLDrawable drawable, int x, int y, int width, int height)
{}
public void display (GLDrawable drawable)
{}
}