import java.awt.*;
public class HJ002 extends java.applet.Applet {
public int i;
public int p_x =0;
public int p_y =0;//左上の座標
public int l_x=400;
public int l_y=100;//辺の長さ
public String msg = "Welcome to our Java Page";
public int R=15;//赤色
public int G=15;//緑色
public int B=15;//青色
 public void paint(Graphics g) {
  for(i=0;i<15;i++) {//外側のフレームを描く
   g.setColor(new Color(0,i*G,i*B));
   g.drawRect(p_x+i,p_y+i,l_x-2*i,l_y-2*i);
  }
  for(i=0;i<15;i++) {//内側のフレームを描く
   g.setColor(new Color(0,(15-i)*G,(15-i)*B));
   g.drawRect(p_x+15+i,p_y+15+i,l_x-30-2*i,l_y-30-2*i);
  }
  for(i=0;i<1000;i++) {//文字の色を変化させる
   g.setColor(new Color(i,0,0));
   g.setFont(new Font("TimesRoman",Font.ITALIC,30));
   g.drawString(msg,p_x+39,p_y+60);
  }
  System.out.println("Paint");
 }
}

Go to Back