Package wprover
Class JAngleFlash
- java.lang.Object
-
- wprover.JFlash
-
- wprover.JAngleFlash
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.util.EventListener
public class JAngleFlash extends JFlash implements java.awt.event.ActionListener
JAngleFlash is a class that extends JFlash and implements ActionListener. It is used to create a flashing angle effect between two lines in a JPanel.
-
-
Constructor Summary
Constructors Constructor Description JAngleFlash(javax.swing.JPanel p)Constructs a new JAngleFlash with the specified JPanel.JAngleFlash(javax.swing.JPanel p, CPoint p1, CPoint p2, CPoint p3, CPoint p4)Constructs a new JAngleFlash with the specified JPanel and points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)Handle action events.booleandraw(java.awt.Graphics2D g2)Draw the graphical elements.booleandrawAllLine(java.awt.Graphics2D g2)Draw all lines with proper styling.voiddrawMAngle(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, int rad, java.awt.Graphics2D g2)Draw a modified angle between two lines.CPointgetCommonPoint()Gets the common point between the two lines forming the angle.intgetRadius()Get the current radius.voidsetAngleTwoLineIntersected(boolean r)Sets whether the angle is formed by the intersection of two lines.voidsetDrawLine1(boolean r)Sets whether the first line should be drawn.voidsetDrawLine2(boolean r)Sets whether the second line should be drawn.voidsetFtype(int t)Sets the type of the angle flash.voidsetRadius(int r)Set the radius value.-
Methods inherited from class wprover.JFlash
drawALine3, drawALine3Short, getColor, getRatioColor, getvisibleType, isfinished, isrRunning, isZero, recalculate, setColor, setDealy, setDrawDash, setDrawDashFb2, start, stop, updateTimer
-
-
-
-
Constructor Detail
-
JAngleFlash
public JAngleFlash(javax.swing.JPanel p)
Constructs a new JAngleFlash with the specified JPanel.- Parameters:
p- the JPanel to associate with this JAngleFlash
-
JAngleFlash
public JAngleFlash(javax.swing.JPanel p, CPoint p1, CPoint p2, CPoint p3, CPoint p4)Constructs a new JAngleFlash with the specified JPanel and points.- Parameters:
p- the JPanel to associate with this JAngleFlashp1- the first point of the first linep2- the second point of the first linep3- the first point of the second linep4- the second point of the second line
-
-
Method Detail
-
setAngleTwoLineIntersected
public void setAngleTwoLineIntersected(boolean r)
Sets whether the angle is formed by the intersection of two lines.- Parameters:
r- true if the angle is formed by intersecting lines, false otherwise
-
setDrawLine1
public void setDrawLine1(boolean r)
Sets whether the first line should be drawn.- Parameters:
r- true if the first line should be drawn, false otherwise
-
setDrawLine2
public void setDrawLine2(boolean r)
Sets whether the second line should be drawn.- Parameters:
r- true if the second line should be drawn, false otherwise
-
getCommonPoint
public CPoint getCommonPoint()
Gets the common point between the two lines forming the angle.- Returns:
- the common point if it exists, null otherwise
-
setFtype
public void setFtype(int t)
Sets the type of the angle flash.- Parameters:
t- the type of the angle flash
-
setRadius
public void setRadius(int r)
Set the radius value.- Parameters:
r- the new radius value
-
getRadius
public int getRadius()
Get the current radius.- Returns:
- the current radius value
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Handle action events. Decrements the counter, stops the animation if necessary, and repaints the panel.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Parameters:
e- the action event triggering this method
-
draw
public boolean draw(java.awt.Graphics2D g2)
Draw the graphical elements. Draws either the provided lines or a modified angle based on the current state.
-
drawMAngle
public void drawMAngle(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, int rad, java.awt.Graphics2D g2)Draw a modified angle between two lines. Calculates the intersection point and draws arcs representing the angle.- Parameters:
x1- the start x-coordinate of the first liney1- the start y-coordinate of the first linex2- the end x-coordinate of the first liney2- the end y-coordinate of the first linex3- the start x-coordinate of the second liney3- the start y-coordinate of the second linex4- the end x-coordinate of the second liney4- the end y-coordinate of the second linerad- the radius used for the angle arcg2- the graphics context for drawing
-
drawAllLine
public boolean drawAllLine(java.awt.Graphics2D g2)
Draw all lines with proper styling. Draws dashed or solid lines based on the internal configuration and available points.- Parameters:
g2- the graphics context used for drawing- Returns:
- true if drawing succeeded; false if required points are missing
-
-