LINE ART

Download LineArt.java. // Student version of the Lab06 Line Art Graphics Program assignment. import java.awt.*; import java.util.concurrent.TimeUnit...

0 downloads 805 Views 189KB Size
// LineArt.java // Student version of the Lab06 Line Art Graphics Program assignment. import java.awt.*; import java.util.concurrent.TimeUnit; import java.applet.*; public class LineArt extends Applet { public void paint(Graphics g) { int width = 980; int height = 630; g.drawRect(10,10,width,height); int counter = 0; // Draw bottom-left corner

int y = 10;

for(int x = 10; x < 990; x = x + 14){

y = y + 9; g.drawLine(10, y, x, 640); }

// Draw bottom-right corner

y = 10; for(int x = 990; x >= 10; x = x - 14){ y = y + 9; g.drawLine(990, y, x, 640);

}

// Draw top-right corner y = 10; for(int x = 10; x < 990; x = x + 14){ y = y + 9; g.drawLine(x, 10, 990, y); } //Draw top-left corner y = 640; for(int x = 10; x < 990; x = x + 14){ y = y - 9; g.drawLine(10, y, x, 10); }

//------------------------------------------------y = 255; int width2 = 490; int height2 = 315; g.drawRect(255,167,width2,height2);

for(int x = 0; x <= 315; x = x + 10){ y = y + 15; g.drawLine(y, 482, 255, x + 167); }

// Draw bottom-right corner

y = 255;

for(int x = 0; x <= 315; x = x + 10){ y = y + 15; g.drawLine(y, 482, 745, 482 - x); }

// Draw top-right corner y = 255; for(int x = 0; x <= 315; x = x + 10){ y = y + 15; g.drawLine(y, 167, 745, x + 167); } //Draw top-left corner y = 255; for(int x = 0; x <= 315; x = x + 10){ y = y + 15; g.drawLine(y, 167, 255, 482 - x); } } }