Java – draw a point on the JPanel

Is there any way to use Java awt. The graphics class draws a point on JPanel? I can't find any such way There are many ways to draw lines and other shapes (for example. DrawLine (int x1, int Y1, int X2, int Y2), but does graphics lack the implementation of drawing the most basic geometric objects?

Solution

You can use this:

Graphics2D g2d = (Graphics2D)g;
g2d.drawOval(5,5,100,100);

Or you can check this article

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
分享
二维码
< <上一篇
下一篇>>