Super simple java to obtain the instance of mouse click position coordinates (the coordinates of the mouse on the JFrame)

1. Place a jlabel label at the top of the window, and the text in the label defaults to "display the coordinates clicked by the right mouse button here"

2. Add a mouse event for the JFrame window. When the mouse right clicks the window, the coordinates of the mouse are displayed in the jlabel label.

Java code implementation

The operation results are as follows:

Java to obtain the location coordinates of the mouse click on the JFrame. The example is very simple and easy to understand. I hope it will be helpful for beginners

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>