Import javax.swing. *; import java.awt. *;
public class BresenhamLine extends JFrame {public static void main (String [] s) {JFrame f = new BresenhamLine (); f.setSize (400,300); f.show ();} public void paint (Graphics g) {bresenhamLine (g , 0, 1, 10, 100, 200, 200); Public Static Void Bresenhamline (Java.awt.Graphics G, Int Dashedmask, Int linewidth, int x1, int y1, int x2, int y2) {Int x, y; int dx, dy; INT INCX, INCY; INT Balance; INT i = 0; IF (x2> = x1) {dx = x2 - x1; incx = 1;} else {dx = x1 - x2; incx = -1;} if (Y2> = Y1) {DY = Y2 - Y1; INCY = 1;} else {DY = Y1 - Y2; INCY = -1;} x = x1; y = y1; if (dx> = DY) {DY << = 1 Balance = DY - DX; DX << = 1; While (x! = X2) {IF (i & dashedmask) == 0) G.Filloval (x, y, linewidth, linewidth); if (balance> = 0) {y = incy; balance - = dx;} balance = DY; x = INCX; I ;} IF ((i & dashedmask) == 0) G.Filloval (x, y, linewidth, linewidth);} else {DX << = 1; balance = DX - Dy; DY << = 1; while (y! =