Lec 22 Working with Images Objects that draw themselves

advertisement
Lec 22
Working with Images
Objects that draw themselves
Some helpful pictures
public class Pad
{
// INSTANCE VARIABLES
private int currentState; // the current state of lilypad
private int startState; // The original state of lilypad
Pad p2 = new Pad(Pad.TOAD);
//
System.out.println("Pad p2 = " + p2 ); // should say T
//
p2.setStatus(Pad.VACANT);
//
System.out.println("Pad p2 = " + p2 ); // should say O
//
System.out.println("Is p2 solved? " + p2.isSolved() ); // should say false
//
p2.setStatus(Pad.FROG);
//
System.out.println("Pad p2 = " + p2 ); // should say F
//
System.out.println("Is p2 solved? " + p2.isSolved() ); // should say false
//
Agenda
• FrogGraphic – how to load and display images
• AppleApplet – how to respond to mouse motion
– Creating objects that have their own paint methods
• Double Buffering to remove screen flicker
Download