8. วัตถุสิ่งของ

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 8-16  โปรแกรมแสดงนาฬิกาตัวเลข
import jlab.graphics.DWindow;
public class DigitalClock {
  public static void main(String[] args) {
    DWindow w = new DWindow(150, 50);
    Time t = new Time();
    while (true) {
      w.clearBackground();
      w.drawString(t.toString(), 30, 10, 10);
      w.sleep(1000);
      t.increment();
    }       
  }
}
©2009 S.Prasitjutrakul