Package wprover

Class 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 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 JAngleFlash
        p1 - the first point of the first line
        p2 - the second point of the first line
        p3 - the first point of the second line
        p4 - 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:
        actionPerformed in interface java.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.
        Specified by:
        draw in class JFlash
        Parameters:
        g2 - the graphics context used for drawing
        Returns:
        true if drawing succeeded
      • 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 line
        y1 - the start y-coordinate of the first line
        x2 - the end x-coordinate of the first line
        y2 - the end y-coordinate of the first line
        x3 - the start x-coordinate of the second line
        y3 - the start y-coordinate of the second line
        x4 - the end x-coordinate of the second line
        y4 - the end y-coordinate of the second line
        rad - the radius used for the angle arc
        g2 - 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