/*********************************************** 直線の描画 ループ1 (900×700) ***********************************************/ import java.applet.*; import java.awt.*; public class Applet_drawLine_loop1 extends Applet { public void paint(Graphics g) { // ------ 縦方向の平行線 ------ int x; for ( x=100 ; x<=300 ; x=x+10 ) { g.drawLine(x, 50, x, 300); } // ------ 横方向の平行線 ------ int y; for ( y=400 ; y<=600 ; y=y+10 ) { g.drawLine(100, y, 300, y); } // ------ 斜め線の模様 ------ g.setColor(Color.blue); for ( x=400 ; x<=800 ; x=x+10 ) { g.drawLine(400, 50, x, 300); } g.setColor(Color.red); for ( x=400 ; x<=800 ; x=x+10 ) { g.drawLine(800, 50, x, 300); } g.setColor(Color.yellow); for ( x=400 ; x<=800 ; x=x+10 ) { g.drawLine(600, 550, x, 300); } } }