Package wprover

Class 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 Detail

      • JCgFlash

        public JCgFlash​(javax.swing.JPanel p)
        Constructs a new JCgFlash with the specified JPanel.
        Parameters:
        p - the JPanel to associate with this JCgFlash
    • 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 CPoint
        b - the second CPoint
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Handles action events for the timer.
        Specified by:
        actionPerformed in interface java.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.
        Specified by:
        draw in class JFlash
        Parameters:
        g2 - the Graphics2D context to draw on
        Returns:
        true if the drawing was successful, false otherwise
      • 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 on
        p1 - the starting CPoint
        p2 - 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 point
        y - the y-coordinate of the center point
        dx - the x-direction unit vector
        dy - the y-direction unit vector
        g2 - the Graphics2D context to draw on