// // Cycloid1 2001/01/24 by ONOZATO Takehisa // // // // 参考図書:Javaではじめるプログラミング //      箕原辰夫著 SHUWA SYSTEM CO.,LTD. 発行2001/1/1 // import java.awt.*; import java.awt.event.*; import java.applet.*; public class Cycloid1 extends Applet implements ItemListener,ActionListener{ Image ofs; //オフスクリーン Graphics grf; //オフスクリーンのGraphicsインスタンス int aplWidth=660; int aplHeight=180; //アプレットの幅と高さ int originX=80; int originY=140; //座標の原点(ピクセル) int unitX=40; int unitY=40; //座標の単位あたりのピクセル数 Color aplBG=new Color(255,240,224); //背景色 Choice cho; //選択メニュー int choIndex; String choList[]={" d / r = 1 "," d / r = 0.5 "," d / r = 1.5 "}; double ratio[]={1, 0.5, 1.5}; int dia=2*unitX; Button btn; //ボタンのインスタンス変数 int flg; //動作の段階(0:静止 1:移動) int theta; //現在の回転角(0〜720) int px[]=new int[721]; //曲線を構成する点の座標 int py[]=new int[721]; public void init(){ flg=0; theta=0; choIndex=0; //初期値 ofs = createImage(aplWidth, aplHeight); grf = ofs.getGraphics(); cho=new Choice(); for(int i=0; i