Two things:
1) line 24 contains invalid syntax.
2) You are right to use a MouseListener, but you never start using it.
That said, your code has a few more problems. Some severe, like not implementing all of the methods of MouseListener and WindowsListener. My advice:
1) Drop AWT. Use Swing instead. AWT is very old and very limited. Swing can do just about anything AWT can do, plus more.
2) Use anonymous inner classes for your listeners. That way you can extend the adapter classes, and you don't need to implement all methods. For instance:
Your class then doesn't need to implement MouseListener or WindowListener anymore.
Speaking of the WindowListener, if you use a JFrame you can achieve the same behaviour with just one line:
And I've given you all the help you need. Just re-read my post carefully.
Nathan Papes
Greenhorn
Joined: May 05, 2012
Posts: 4
posted
0
Rob Spoor wrote:And I've given you all the help you need. Just re-read my post carefully.
I have the code compiled and the program is functional, for that, thanks for all your help!
I have one more quick question(not a huge deal though), the program does not always return the coordinate values when the mouse is clicked??
I don't have much experience with java and troubleshooting, do you know an explanation for this?
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
1
> the program does not always return the coordinate values when the mouse is clicked??
mouseClicked() doesn't always fire, better to use mousePressed()
Nathan Papes
Greenhorn
Joined: May 05, 2012
Posts: 4
posted
0
Michael Dunn wrote:> the program does not always return the coordinate values when the mouse is clicked??
mouseClicked() doesn't always fire, better to use mousePressed()