/*------------------------------ ex11_7.java アプレット:矩形グラデーション -------------------------------*/ import java.applet.*; import java.awt.*; /* */ public class ex11_7 extends Applet { public void paint(Graphics g) { int x = 10, y = 10, wid = 200, hei = 100; int red = 0, grn = 255, blu = 0; Color col; for (int i = 0; i < 15; i++) { col = new Color(red,grn,blu); g.setColor(col); g.drawRect(x, y, wid, hei); x += 20; y += 10; wid -= 10; hei += 5; red += 15; grn -= 15; blu += 5; } } }