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