Package wprover
Class JCgFlash
- java.lang.Object
-
- wprover.JFlash
-
- wprover.JCgFlash
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.util.EventListener
public class JCgFlash extends JFlash implements java.awt.event.ActionListener
JCgFlash is a class that extends JFlash and implements ActionListener. It is used to create a flashing effect on a JPanel with specified points.
-
-
Constructor Summary
Constructors Constructor Description JCgFlash(javax.swing.JPanel p)Constructs a new JCgFlash with the specified JPanel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)Handles action events for the timer.voidaddACg(CPoint a, CPoint b)Adds a pair of CPoints to the vector list.booleandraw(java.awt.Graphics2D g2)Draws the flashing effect on the specified Graphics2D context.booleandraw(java.awt.Graphics2D g2, CPoint p1, CPoint p2)Draws a line between two CPoints with a flashing effect.voiddrawALine(double x, double y, double dx, double dy, java.awt.Graphics2D g2)Draws a line segment with a specified direction and length.intgetDNum()Gets the number of divisions.voidsetDNum(int n)Sets the number of divisions.voidsetDrawdTT(boolean t)Sets whether the drawTT flag is enabled.-
Methods inherited from class wprover.JFlash
drawALine3, drawALine3Short, getColor, getRatioColor, getvisibleType, isfinished, isrRunning, isZero, recalculate, setColor, setDealy, setDrawDash, setDrawDashFb2, start, stop, updateTimer
-
-
-
-
Method Detail
-
setDrawdTT
public void setDrawdTT(boolean t)
Sets whether the drawTT flag is enabled.- Parameters:
t- true to enable drawTT, false to disable
-
setDNum
public void setDNum(int n)
Sets the number of divisions.- Parameters:
n- the number of divisions
-
getDNum
public int getDNum()
Gets the number of divisions.- Returns:
- the number of divisions
-
addACg
public void addACg(CPoint a, CPoint b)
Adds a pair of CPoints to the vector list.- Parameters:
a- the first CPointb- the second CPoint
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Handles action events for the timer.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Parameters:
e- the action event
-
draw
public boolean draw(java.awt.Graphics2D g2)
Draws the flashing effect on the specified Graphics2D context.
-
draw
public boolean draw(java.awt.Graphics2D g2, CPoint p1, CPoint p2)Draws a line between two CPoints with a flashing effect.- Parameters:
g2- the Graphics2D context to draw onp1- the starting CPointp2- the ending CPoint- Returns:
- true if the drawing was successful, false otherwise
-
drawALine
public void drawALine(double x, double y, double dx, double dy, java.awt.Graphics2D g2)Draws a line segment with a specified direction and length.- Parameters:
x- the x-coordinate of the center pointy- the y-coordinate of the center pointdx- the x-direction unit vectordy- the y-direction unit vectorg2- the Graphics2D context to draw on
-
-