org.problets.lib.io.output.overlay
Class OverlayBox
java.lang.Object
org.problets.lib.io.output.overlay.Overlay
org.problets.lib.io.output.overlay.OverlayBox
public class OverlayBox
- extends Overlay
Class which either animates a box by expanding it from one pixel,
or draws a box without animating it.
- Author:
- Tihomir Piskuliyski
Constructor Summary |
OverlayBox(int inWidth,
int inHeight,
java.awt.Color inColor)
The constructor takes values for the width, height and the color
of the box. |
Method Summary |
void |
animate(java.awt.Graphics g,
int x,
int y)
Animates a box. |
void |
draw(java.awt.Graphics g,
int x,
int y)
Draws a box |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OverlayBox
public OverlayBox(int inWidth,
int inHeight,
java.awt.Color inColor)
- The constructor takes values for the width, height and the color
of the box.
- Parameters:
inWidth
- The width of the bounding box of the ellipseinHeight
- The height of the bounding box of the ellipseinColor
- The color of the ellipse
draw
public void draw(java.awt.Graphics g,
int x,
int y)
- Draws a box
- Overrides:
draw
in class Overlay
- Parameters:
g
- The graphical context of the appletx
- The x coordinate of the upper left corner the bounding box of the ellipsey
- The y coordinate of the upper left corner the bounding box of the ellipse
animate
public void animate(java.awt.Graphics g,
int x,
int y)
- Animates a box. If the box is animated once
and the applet has to be redrawn, the function only draws the box without
animating it. The box is animated in approximately one a second drawing
four lines, which enclose what the object drawn so far, each MillisecondsIterator
milli seconds. The animation starts from the center of the box and the box expands
outwards. There are three special cases in the animation. CASE 1: If the
height is bigger than the width CASE 2: If the width is bigger than the height
CASE 3: if the width and the height are equal.
- Overrides:
animate
in class Overlay
- Parameters:
g
- The graphical context of the appletx
- The x coordinate of the upper left corner the bounding box of the ellipsey
- The y coordinate of the upper left corner the bounding box of the ellipse