You are here: Home / Topics / Program to draw line in Applet using drawLine() method in Java

Program to draw line in Applet using drawLine() method in Java

Filed under: Java on 2023-10-16 07:01:37

//  Program to draw line in Applet using drawLine() method.

import java.awt.*;
import java.applet.*;

/*
<applet code="DrawLineTest1a" width="200" height="100" >
</applet>
*/

public class DrawLineTest1a  extends  Applet  
{
public void paint(Graphics g) 
{
 setBackground( Color.yellow );
 g.drawLine(20, 20, 180, 80);
}
}

About Author:
J
Java     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.