Package wprover

Class JFlash

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.awt.Color color  
      static java.awt.BasicStroke Dash  
      static java.awt.BasicStroke DASH1  
      protected boolean fb  
      protected boolean finished  
      protected int n  
      protected javax.swing.JPanel panel  
      protected int TIME_INTERVAL  
      protected javax.swing.Timer timer  
      protected boolean vType  
      protected static double ZERO  
    • Constructor Summary

      Constructors 
      Constructor Description
      JFlash​(javax.swing.JPanel p)
      Constructs a new JFlash with the specified JPanel.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean draw​(java.awt.Graphics2D g2)
      Draws the flash effect on the specified Graphics2D context.
      static void drawALine3​(CPoint p1, CPoint p2, double x, double y, boolean ln, java.awt.Graphics2D g2)
      Draws a line segment between a point and the closer of two other points, with optional line drawing.
      static void drawALine3Short​(CPoint p1, CPoint p2, double x, double y, java.awt.Graphics2D g2)
      Draws a line segment between a point and the closer of two other points.
      java.awt.Color getColor()
      Gets the color of the flash.
      protected static java.awt.Color getRatioColor​(int c1, int c2, double ra)
      Gets a color that is a blend of two colors based on a ratio.
      boolean getvisibleType()
      Gets the visibility type of the flash.
      boolean isfinished()
      Checks if the flash effect is finished.
      boolean isrRunning()
      Checks if the timer is running.
      boolean isZero​(double d)
      Checks if the given value is approximately zero.
      void recalculate()
      Recalculates the flash effect.
      void setColor​(java.awt.Color c)
      Sets the color of the flash.
      void setDealy​(int n)
      Sets the delay for the timer.
      void setDrawDash​(java.awt.Graphics2D g2)
      Sets the drawing stroke to a dashed line with a red color.
      void setDrawDashFb2​(java.awt.Graphics2D g2)
      Sets the drawing stroke to either a bold or dashed line with a red color based on the fb flag.
      void start()
      Starts the flash effect.
      void stop()
      Stops the flash effect.
      void updateTimer()
      Updates the timer delay to the flash interval defined in CMisc.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • timer

        protected javax.swing.Timer timer
      • panel

        protected javax.swing.JPanel panel
      • n

        protected int n
      • ZERO

        protected static double ZERO
      • Dash

        public static final java.awt.BasicStroke Dash
      • DASH1

        public static final java.awt.BasicStroke DASH1
      • color

        protected java.awt.Color color
      • finished

        protected boolean finished
      • vType

        protected boolean vType
      • fb

        protected boolean fb
      • TIME_INTERVAL

        protected int TIME_INTERVAL
    • Constructor Detail

      • JFlash

        public JFlash​(javax.swing.JPanel p)
        Constructs a new JFlash with the specified JPanel.
        Parameters:
        p - the JPanel to associate with this JFlash
    • Method Detail

      • updateTimer

        public void updateTimer()
        Updates the timer delay to the flash interval defined in CMisc.
      • setDealy

        public void setDealy​(int n)
        Sets the delay for the timer.
        Parameters:
        n - the delay in milliseconds
      • getvisibleType

        public boolean getvisibleType()
        Gets the visibility type of the flash.
        Returns:
        true if the flash is visible, false otherwise
      • setColor

        public void setColor​(java.awt.Color c)
        Sets the color of the flash.
        Parameters:
        c - the color to set
      • getColor

        public java.awt.Color getColor()
        Gets the color of the flash.
        Returns:
        the color of the flash
      • draw

        public abstract boolean draw​(java.awt.Graphics2D g2)
        Draws the flash effect on the specified Graphics2D context.
        Parameters:
        g2 - the Graphics2D context to draw on
        Returns:
        true if the drawing was successful, false otherwise
      • recalculate

        public void recalculate()
        Recalculates the flash effect. This method is intended to be overridden by subclasses.
      • start

        public void start()
        Starts the flash effect.
      • stop

        public void stop()
        Stops the flash effect.
      • isfinished

        public boolean isfinished()
        Checks if the flash effect is finished.
        Returns:
        true if the flash effect is finished, false otherwise
      • isrRunning

        public boolean isrRunning()
        Checks if the timer is running.
        Returns:
        true if the timer is running, false otherwise
      • setDrawDash

        public final void setDrawDash​(java.awt.Graphics2D g2)
        Sets the drawing stroke to a dashed line with a red color.
        Parameters:
        g2 - the Graphics2D context to set the stroke on
      • setDrawDashFb2

        public final void setDrawDashFb2​(java.awt.Graphics2D g2)
        Sets the drawing stroke to either a bold or dashed line with a red color based on the fb flag.
        Parameters:
        g2 - the Graphics2D context to set the stroke on
      • isZero

        public final boolean isZero​(double d)
        Checks if the given value is approximately zero.
        Parameters:
        d - the value to check
        Returns:
        true if the value is approximately zero, false otherwise
      • drawALine3Short

        public static void drawALine3Short​(CPoint p1,
                                           CPoint p2,
                                           double x,
                                           double y,
                                           java.awt.Graphics2D g2)
        Draws a line segment between a point and the closer of two other points.
        Parameters:
        p1 - the first point
        p2 - the second point
        x - the x-coordinate of the third point
        y - the y-coordinate of the third point
        g2 - the Graphics2D context to draw on
      • drawALine3

        public static void drawALine3​(CPoint p1,
                                      CPoint p2,
                                      double x,
                                      double y,
                                      boolean ln,
                                      java.awt.Graphics2D g2)
        Draws a line segment between a point and the closer of two other points, with optional line drawing.
        Parameters:
        p1 - the first point
        p2 - the second point
        x - the x-coordinate of the third point
        y - the y-coordinate of the third point
        ln - whether to draw the line segment between p1 and p2
        g2 - the Graphics2D context to draw on
      • getRatioColor

        protected static java.awt.Color getRatioColor​(int c1,
                                                      int c2,
                                                      double ra)
        Gets a color that is a blend of two colors based on a ratio.
        Parameters:
        c1 - the first color index
        c2 - the second color index
        ra - the ratio for blending the colors
        Returns:
        the blended color