public class SinDataCreator implements DataCreator { protected BarMeterApplet applet; public SinDataCreator(){} public void setBarMeterApplet(BarMeterApplet applet){ this.applet = applet; } public void start(){ // 指示値を生成するためのスレッドを作成 Thread thread = new Thread(this); thread.start(); } protected double dataCreate(double x){ return Math.sin(x*Math.PI/180.0); } public void run(){ double value; while(true){ for(int i = 0 ; i < 360 ; i++){ // 指示値を生成 value = dataCreate((double)i); // 指示値の設定 applet.setValue(value); try{ Thread.sleep(100); }catch(InterruptedException ex){ return; } } } } }