This is right from a book I'm reading but it doesn't work. The problem is to write an application that lets you determine the integer value
returned by the InputEvent method getModifiers() when you click your left, right, or middle mouse button on a JFrame.
This is the code copied directly from the book. Can someone tell me what is missing:
posted 2 years ago
1) the MouseListener code should be part of the main() method.
2) then once you create the listener you need to add the listener to the frame.
I would suggest you read the section from the Swing tutorial on How to Write a MouseListener for more information and a better example on how to write the code so that the GUI is created on the Event Dispatch Thread.