import java.applet.*; import java.awt.*; /*-------------------------------------  直線の描画 ループ1(900×700) -------------------------------------*/ public class AppletDrawLineLoop1 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+=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.yellow); for ( x=400 ; x<=800 ; x=x+10 ) { g.drawLine(800, 50, x, 300); } g.setColor(Color.magenta); for ( x=400 ; x<=800 ; x=x+10 ) { g.drawLine(600, 50, x, 300); } } }