Download presentation
Presentation is loading. Please wait.
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()
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.