explain about drawing linesdrawing straight lines


Explain about Drawing Lines?

Drawing straight lines along with Java is easy. Just call
g.drawLine(x1, y1, x2, y2)
where (x1, y1) and (x2, y2) are the endpoints of your lines and g is the Graphics object you're drawing along with.
This program draws a line diagonally across the applet.
import java.applet.*;
import java.awt.*;

public class SimpleLine extends Applet {

public void paint(Graphics g) {

g.drawLine(0, 0, this.getSize().width, this.getSize().height);

}

}
Here's the result

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: explain about drawing linesdrawing straight lines
Reference No:- TGS0285143

Expected delivery within 24 Hours