Draw line

This applet draws a line between two points. The points are (x,y) coordinate points measured in pixels. In this case between the points (0,0) and (100,100)

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

public class FirstLine extends Applet {

public void paint(Graphics g) {

g.drawLine (0,0,100,100);

}

}

This is what it produces:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License