Package wprover
Class JTriFlash
- java.lang.Object
-
- wprover.JFlash
-
- wprover.JTriFlash
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.util.EventListener
public class JTriFlash extends JFlash implements java.awt.event.ActionListener
JTriFlash is a class that extends JFlash and implements ActionListener. It is used to create a triangular flashing effect on a JPanel.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)Handles the action event by updating the animation state and repainting the panel.booleandraw(java.awt.Graphics2D g2)Draws the triangular flash effect onto the provided graphics context.voiddrawColoredTriangle(int[] p1, int[] p2, java.awt.Graphics2D g2)Draws an outline of the triangle using the specified vertex coordinates.voiddrawFirstTriangle(java.awt.Graphics2D g2)Draws the first triangle of the flash animation using the initial set of coordinates.voiddrawLastTriangle(java.awt.Graphics2D g2)Draws the final triangle of the flash effect using the last computed set of coordinates.voiddrawTiangle(java.awt.Graphics2D g2, int index)Draws a triangle at the specified index from the precomputed coordinate arrays.voidrecalculate()Recalculates the flash animation by reinitializing its state based on the current direction.voidstart()Starts the flash effect.-
Methods inherited from class wprover.JFlash
drawALine3, drawALine3Short, getColor, getRatioColor, getvisibleType, isfinished, isrRunning, isZero, setColor, setDealy, setDrawDash, setDrawDashFb2, stop, updateTimer
-
-
-
-
Method Detail
-
start
public void start()
Description copied from class:JFlashStarts the flash effect.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Handles the action event by updating the animation state and repainting the panel.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Parameters:
e- the action event triggering the update
-
recalculate
public void recalculate()
Recalculates the flash animation by reinitializing its state based on the current direction.- Overrides:
recalculatein classJFlash
-
draw
public boolean draw(java.awt.Graphics2D g2)
Draws the triangular flash effect onto the provided graphics context.
-
drawFirstTriangle
public void drawFirstTriangle(java.awt.Graphics2D g2)
Draws the first triangle of the flash animation using the initial set of coordinates.- Parameters:
g2- the graphics context to draw the triangle on
-
drawColoredTriangle
public void drawColoredTriangle(int[] p1, int[] p2, java.awt.Graphics2D g2)Draws an outline of the triangle using the specified vertex coordinates.- Parameters:
p1- an array containing the x-coordinates of the triangle's verticesp2- an array containing the y-coordinates of the triangle's verticesg2- the graphics context for drawing the triangle outline
-
drawLastTriangle
public void drawLastTriangle(java.awt.Graphics2D g2)
Draws the final triangle of the flash effect using the last computed set of coordinates.- Parameters:
g2- the graphics context on which to draw the triangle
-
drawTiangle
public void drawTiangle(java.awt.Graphics2D g2, int index)Draws a triangle at the specified index from the precomputed coordinate arrays.- Parameters:
g2- the graphics context used for drawing the triangleindex- the index of the coordinate arrays to use for drawing
-
-