Presentation is loading. Please wait.

Presentation is loading. Please wait.

Albert Johnson Molly Richardson Andrew Kruth.  Threads Runnable interface sleep()  GUIs repaint() paintComponent()

Similar presentations


Presentation on theme: "Albert Johnson Molly Richardson Andrew Kruth.  Threads Runnable interface sleep()  GUIs repaint() paintComponent()"— Presentation transcript:

1 Albert Johnson Molly Richardson Andrew Kruth

2  Threads Runnable interface sleep()  GUIs repaint() paintComponent()

3  Class that implements Runnable run() try – catch sleep()  class MyThread implements Runnable { public MyThread(…..parameters…..){  ……..Initialize class variables……  } public void run() {  for........ {  Stuff………….  try { Thread.sleep(DELAY); }  catch(InterruptedException e) {}  }

4  Main class that creates your Runnable object  public static void main (String args[]) { …..set your initial values….. MyThread thread = new MyThread(..parameters..); Thread t = new Thread(thread); Thread.start(t); }

5  Animation = threads + GUIs.  Basic Ideas for animation: paintComponent()  this is where your GUIs will be. MyThread  run()  This is where you change your positions  sleep() – necessary to be able to see the animation  repaint()


Download ppt "Albert Johnson Molly Richardson Andrew Kruth.  Threads Runnable interface sleep()  GUIs repaint() paintComponent()"

Similar presentations


Ads by Google