Package wprover

Class JLineFlash

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.util.EventListener

    public class JLineFlash
    extends JFlash
    implements java.awt.event.ActionListener
    A class that represents a flashing line effect.
    • Constructor Detail

      • JLineFlash

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

      • addALine

        public int addALine()
        Adds a new line to the list of lines to be flashed.
        Returns:
        the index of the newly added line
      • setInfinitLine

        public void setInfinitLine​(int n)
        Sets a line to be drawn infinitely.
        Parameters:
        n - the index of the line to set as infinite
      • addAPoint

        public void addAPoint​(int index,
                              CPoint p)
        Adds a point to a line at the specified index.
        Parameters:
        index - the index of the line to add the point to
        p - the point to add
      • setAlternate

        public void setAlternate​(boolean a)
        Sets the alternate flashing mode.
        Parameters:
        a - true to enable alternate flashing mode, false otherwise
      • draw

        public boolean draw​(java.awt.Graphics2D g2)
        Draws the flashing lines 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
      • 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
      • stop

        public void stop()
        Stops the flashing effect.
        Overrides:
        stop in class JFlash