/***********************************   ループを利用した直線の模様(2) (400×700) ************************************/ import java.applet.*; import java.awt.*; public class Applet_drawLine_loop2 extends Applet { public void paint(Graphics g) { // 直線の模様(中1点で交差する模様) int xstart,xend; xstart=100; xend=300; for ( int n=1 ; n<=20 ; n++ ) { g.drawLine(xstart, 100, xend, 300); xstart+=10; xend-=10; } // 直線でカーブを描く g.drawLine(100, 400, 300, 400); //横軸 g.drawLine(100, 400, 100, 600); //縦軸 int step; step=0; for ( int n=1 ; n<=20 ; n++ ) { step=step+10; g.drawLine(100+step,400,100,600-step); } } }