Ex10_1



import java.applet.*;
import java.awt.*;

public class Ex10_1 extends Applet {
	Color col;	// カラークラス
	Font ft;	// フォントクラス
	int red, grn, blu;	// 色用の変数宣言(赤, 緑, 青)

	public void paint(Graphics g) {
		g.drawString("Hello World", 10, 20);	// (10,20)に文字を書く

		g.setColor(Color.red);		// default色を設定
		g.drawString("赤色になったよね!", 10, 40);

		g.setColor(Color.blue);		// default色を設定
		g.drawString("青のが好きかなー", 10, 60);

		col = new Color(0x00FF99);	// 新しい色を作る[16進数]
		g.setColor(col);			// 色設定
		g.drawString("RGB(00FF99)色だよ。16進数設定!", 10, 80);

		red = 255;
		grn = 0;
		blu = 125;
		col = new Color(red, grn, blu);	// 新しい色を作る[10進数]
		g.setColor(col);			// 色設定
		g.drawString("RGB(255,0,125)色だよ。10進数設定!", 10, 100);

		for (red=0; red<255; red+=5) {	// グラデーション
			col = new Color(red, grn, blu);
			g.setColor(col);
			g.drawString("●", 10+red, 120);
		}

		for (int i=0; i<255; i+=5) {	// グラデーション
			col = new Color(i, 255-i, 0);
			g.setColor(col);
			g.drawString("◆", 10+i, 140);
		}

		ft = new Font("Elephant", Font.BOLD, 20);	// フォントを作る
		g.setFont(ft);				// フォント設定
		g.drawString("Elephant!", 20, 160);

		ft = new Font("Rockwell", Font.PLAIN, 16);
		g.setFont(ft);
		g.drawString("Rockwell", 20, 180);

		ft = new Font("HGP行書体", Font.PLAIN, 24);
		g.setFont(ft);
		g.drawString("HGP行書体", 20, 210);
	}
}