// // exButton2 2001/12/01 by ONOZATO Takehisa // // サンプル:アニメーション(三角形の回転) // // // import java.awt.*; import java.applet.*; import java.awt.event.*; public class exButton2 extends Applet implements ActionListener{ Image ofs; Graphics grf; //オフスクリーン int ofsWidth=400; int ofsHeight=300; Color ofsBG=new Color(255,255,255); //背景色(白) Button btn[]=new Button[3]; //ボタン int btnLeft[]={100,170,240}; int btnTop[]={20,20,20}; int btnWidth=60; int btnHeight=20; String btnCaption[]={"スタート","ストップ","イニシャル"}; String btnAction[]={"0","1","2"}; int btnIndex; //押されたボタン int ptA[]={200,180}; //回転の中心のピクセル座標 int ptB[][]={{130,160},{270,160},{230,90}}; //三角形の頂点座標(初期値) int ptX[]=new int[3]; int ptY[]=new int[3]; //回転中の頂点のx,y座標 boolean flgMove; //回転中 int t; //移動パラメータ(回転角) int dt=5; //増分 public void init() { ofs=createImage(ofsWidth,ofsHeight); grf=ofs.getGraphics(); for(int i=0; i