Newest Viewed Downloaded

AnimationAlbert Johnson Molly Richardson Andrew Kruth

Animation

Albert Johnson Molly Richardson Andrew Kruth

Concepts

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

Quick Thread Review

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) {} }

Quick Thread Review cont…

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); }

The Animation Part

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()

Showing 1 - 5 of 5 items Details

Name: 
21b2 Animation Pre...
Author: 
Andrew Kruth
Company: 
Rose-Hulman Institute ...
Description: 
AnimationAlbert Johnson Molly Richardson Andrew Kruth
Tags: 
thread | mythread | anim | class | sleep | runnabl | run | gui
Created: 
10/17/2007 12:45:17 AM
Slides: 
5
Views: 
0
Downloads: 
0
Rating: 
0


> Comment



Share this presentation
|

Comments

Share this presentation:

|
Sitemap