public class joglpbuffer implements
GLEventListener,
MouseListener,
MouseMotionListener {
public void init(GLAutoDrawable drawable) {
drawable.addMouseListener(this);
drawable.addMouseMotionListener(this);
}
}
The event functions themselves are self explanatory. They are all passed a MouseEvent argument which can be used to determine the location of the mouse or the button that was just pressed.
public void mouseClicked(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {}
public void mousePressed(MouseEvent e) {
prevMouseX = e.getX();
prevMouseY = e.getY();
if ((e.getModifiers() & e.BUTTON3_MASK) != 0) {
mouseRButtonDown = true;
}
}
public void mouseReleased(MouseEvent e) {
if ((e.getModifiers() & e.BUTTON3_MASK) != 0) {
mouseRButtonDown = false;
}
}
public void mouseDragged(MouseEvent e) {
int x = e.getX();
int y = e.getY();
}