/* @(#)SpinningAnimationApplet.java 1 November 2007 */ import edu.neu.ccs.*; import edu.neu.ccs.gui.*; import edu.neu.ccs.util.*; import java.awt.*; import java.net.*; import javax.swing.*; public class SpinningAnimationApplet extends DirectApplet implements JPTConstants { public Object createGUI() { setBirdPaintable(); panel.setDeepBackground(Colors.yellow, JButton.class); return panel; } protected Shape star = RegularShape.star(0, 0, 100, 7, 3); protected ShapePaintable starPaintable = new ShapePaintable(star, PaintMode.FILL_DRAW, Color.red); protected ImagePaintable birdPaintable = new ImagePaintable(); protected Shape circle = new XOval(0, 0, 400, 400); protected ClippingWrapper birdPaintableWrapper = new ClippingWrapper(birdPaintable, circle); protected SimpleAction launchStarAction = new SimpleAction("Launch Star Animation") { public void perform() { new SpinningAnimation(starPaintable, 220, 220, "Star Animation"); } }; protected SimpleAction launchBirdAction = new SimpleAction("Launch Bird Animation") { public void perform() { new SpinningAnimation(birdPaintableWrapper, 420, 420, "Bird Animation"); } }; protected Object[] stuff = { launchStarAction, launchBirdAction }; protected VTable panel = new VTable(stuff, 20, 20, CENTER); protected void setBirdPaintable() { try { String loc = "http://www.ccs.neu.edu/jpt/images/general/woodpecker.jpg"; URL url = new URL(loc); birdPaintable.setImageByURL(url); } catch (Throwable exception) {} } }