[[日録]] Eclipse で新規 Java プロジェクトを作成する.名称は適当に. 次に,プロジェクト名の上で右クリックし,新規で [ファイル] [Class] を選択. 新規クラス名を仮に DateApplet とし,スーパークラスと,インターフェイスを図のように指定. クラスファイルが作成されたところで,メニューの [ソース] [実装] を選び, + Applet クラスの start と stop + Runnable クラスの run を追加する. その上で,以下のようにコードを記入. import java.applet.Applet; import java.util.Date; public class DateApplet extends Applet implements Runnable { Date theDate; Thread runner; public void stop() { // TODO Auto-generated method stub //super.stop(); if(runner != null){ runner.interrupt(); runner = null; } } public void start() { // TODO Auto-generated method stub //super.start(); if(runner == null){ runner = new Thread(this); runner.start(); } } public void run() { // TODO Auto-generated method stub while(true){ theDate = new Date(); repaint(); try{Thread.sleep(1000);} catch(InterruptedException e){} } } }