transformation
Class AnimatedArrow
java.lang.Object
transformation.AnimatedArrow
- ActionListener
public class AnimatedArrow
extends java.lang.Object
implements ActionListener
class for drawing animated arrows. Start by placing method
drawAnimatedArrow() in the paintComponent() method of JPanel
panel. Now every millisecond*speed, Timer t fires an ActionEvent
which causes one single arrow to be painted.
void | actionPerformed(ActionEvent e) - handels the ActionEvents that are fired every
milli-second by Timer t
|
void | drawAnimatedArrow(Graphics g, Point p1, Point p2, String s) - starts drawing an animated Arrow from Point p1
to Point p2;
is to be placed in the paintComponent method of
the calling JPanel
|
void | drawArrow(Graphics g, Point p, String s) - draws an arrow from point p1 to point p
|
boolean | finished()
|
boolean | isRunning()
|
void | reset()
|
void | restartTimer()
|
void | setSpeed(int speed)
|
void | stopTimer()
|
FAST
public static final int FAST
MEDIUM
public static final int MEDIUM
SLOW
public static final int SLOW
arrowFont
private Font arrowFont
counter
private int counter
finished
private boolean finished
firstTime
private boolean firstTime
gradient
private double gradient
panel
private JPanel panel
stringFont
private Font stringFont
AnimatedArrow
(package private) AnimatedArrow(JPanel p)
p
- TransformationPanel where to draw on
actionPerformed
public void actionPerformed(ActionEvent e)
handels the ActionEvents that are fired every
milli-second by Timer t
drawAnimatedArrow
public void drawAnimatedArrow(Graphics g,
Point p1,
Point p2,
String s)
starts drawing an animated Arrow from Point p1
to Point p2;
is to be placed in the paintComponent method of
the calling JPanel
g
- Graphics object of the calling JPanelp1
- starting Pointp2
- ending Points
- String which is to be painted in front of the arrowhead
drawArrow
public void drawArrow(Graphics g,
Point p,
String s)
draws an arrow from point p1 to point p
g
- Graphics object of the calling JPanelp
- ending Point of the arrows
- String which is painted in front of the arrowhead
finished
public boolean finished()
isRunning
public boolean isRunning()
restartTimer
public void restartTimer()
setSpeed
public void setSpeed(int speed)
stopTimer
public void stopTimer()