thebarslider
Programmer
I am using Java2 with OpenGl to draw a triangle of vertices red, blue and green. I want to be able to press R and then click on the applet to resize the red vertex of my triangle. So far i have a KeyListener and a MouseListener but so far i have to click then press a key to resize the triangle. I want to be able to press a key then click to resize the triangle. How do i make the program wait for a mouse event before drawing the triangle?
case KeyEvent.VK_R:
message = "Set Red Vertex with Mouse";
// I want to get the program to wait for a mouse event at this point. How do i do that?
vertex[0] = x;
vertex[1] = y;
break;
I already have the below mouseClicked method:
public void mouseClicked(MouseEvent e) {
lastClick = e.getPoint();
// gets the last click in screen coords
}
I am really quite stuck on this problem, any help would be gladly accepted.
Mark.
case KeyEvent.VK_R:
message = "Set Red Vertex with Mouse";
// I want to get the program to wait for a mouse event at this point. How do i do that?
vertex[0] = x;
vertex[1] = y;
break;
I already have the below mouseClicked method:
public void mouseClicked(MouseEvent e) {
lastClick = e.getPoint();
// gets the last click in screen coords
}
I am really quite stuck on this problem, any help would be gladly accepted.
Mark.