how to Write a java program that allows the user to draw lines,rectangles and ovals.

Join Our Official Freshers Jobs Telegram Channel

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about Write a java program that allows the user to draw lines,rectangles and ovals. Java Source Code.  

 

import java.awt.*;
import java.applet.*;
public class Draw extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.BLUE);
g.drawLine(3,4,10,23);
g.drawOval(195,100,90,55);
g.drawRect(100,40,90,5);
g.drawRoundRect(140,30,90,90,60,30);
}
}
/*<applet code="Draw.class" width=300 height=300></applet>*/

 

OUTPUT:-

So I hope that you learn about the Write a java program that allows the user to draw lines,rectangles and ovals.. And if you have any more queries about computer relegated then feel free to discuss your problem in the comment section.Thank you so much and come back for more updates about Techgsr.co .