org.problets.lib.io.output.overlay
Class OverlayArrow
java.lang.Object
org.problets.lib.io.output.overlay.Overlay
org.problets.lib.io.output.overlay.OverlayArrow
public class OverlayArrow
- extends Overlay
Class which either animates an arrow by expanding it from one pixel,
or draws an arrow without animating it. The arrow is created by drawing
a pie of a circle for the head of the arrow and a rectangle for
the base of the arrow
- Author:
- Tihomir Piskuliyski
Field Summary |
static int |
NORTH
|
Constructor Summary |
OverlayArrow(java.lang.String inSize,
java.lang.String inDirection,
java.awt.Color inColor)
The constructor takes values for the size of the arrow, a string
indicating the direction in whcih the arrow points, and the color of the
arrow |
Method Summary |
void |
animate(java.awt.Graphics g,
int x,
int y)
Animates an arrow. |
void |
draw(java.awt.Graphics g,
int x,
int y)
Draws an arrow. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NORTH
public static final int NORTH
- See Also:
- Constant Field Values
OverlayArrow
public OverlayArrow(java.lang.String inSize,
java.lang.String inDirection,
java.awt.Color inColor)
- The constructor takes values for the size of the arrow, a string
indicating the direction in whcih the arrow points, and the color of the
arrow
- Parameters:
inSize
- The Size of the arrow whcih can be an integer value from 1 to 3
If a different value if passed a default value of 2 is choseninDirection
- The direction in which the arrow points.inColor
- The color of the arrow
draw
public void draw(java.awt.Graphics g,
int x,
int y)
- Draws an arrow. First a ractangle si drawn for the base of the arrow.
Then a pie of a circle with angle spread ANGLE is drawn as the head of the arrow.
Then the arrow is rotated in the direction inwhcih it is supposed to point
- Overrides:
draw
in class Overlay
- Parameters:
g
- The graphical context of the appletx
- The x coordinate of the tip of the arrowy
- The y coordinate of the tip of the arrow
animate
public void animate(java.awt.Graphics g,
int x,
int y)
- Animates an arrow. If the arrow is animated once and the applet has
to be redrawn, the function only draws the arrow without animating it.
First the function animates a rectangle which serves for the base of the arrow.
This is done by drawing one line each MillisecondsIterator milli senconds
from the bottom to the top of the rectangle. Then the head of the arrow is
drawn by drawing an smaller and smaller archs each MillisecondsIterator
milli senconds till the tip of the arrow is reached. Then the arrow is
rotated in the direction inwhcih it is supposed to point
- Overrides:
animate
in class Overlay
- Parameters:
g
- The graphical context of the appletx
- The x coordinate of the tip of the arrowy
- The y coordinate of the tip of the arrow