/* * XAdder.java -- * * animation stuff. * * Copyright 1995 Regents of the University of California * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that this copyright * notice appears in all copies. The University of California * makes no representations about the suitability of this * software for any purpose. It is provided "as is" without * express or implied warranty. * * rcsid = "$Header: /disks/barad-dur/now/rywang/src/java/classes/ryw/XAdder.java,v 1.1 1995/10/07 14:15:39 rywang Exp $ xFS (Berkeley)" */ package ryw; import java.awt.*; import java.awt.image.*; import java.util.Vector; import java.util.Enumeration; /** * A runnable object that performs animations. * It has a queue of actions to be performed. * the thread repeadely dequeues this queue and performs the addition. * @see ryw.XMover */ public class XAdder extends XAnim { final int addSleep = 1000; private void addOne (XPanel0 parent, Component comp, Point pos, Dimension dim) { parent.add (comp, pos, dim); comp.repaint (); if (addSleep > 0) { try { Thread.sleep (addSleep); } catch (InterruptedException e) { return; } } } public void run () { Enumeration addElements = this.elements (); while (addElements.hasMoreElements ()) { XAddElement ae = (XAddElement) addElements.nextElement (); addOne (ae.parent, ae.comp, ae.pos, ae.dim); } } }