Package wprover

Class JLine


  • public class JLine
    extends java.lang.Object
    JLine class represents a line in a graphical context. It allows adding points, drawing the line, and setting properties like infinite drawing.
    • Constructor Summary

      Constructors 
      Constructor Description
      JLine()
      Constructs a new JLine.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAPoint​(CPoint p)
      Adds a point to the list of points defining the line.
      boolean containPt​(CPoint pt)
      Checks if the specified point is contained in the list of points defining the line.
      boolean draw​(java.awt.Graphics2D g2)
      Draws the line on the specified Graphics2D context.
      void drawLine​(java.awt.Graphics2D g2)
      Draws the line between the maximum and minimum points on the specified Graphics2D context.
      void drawPt​(java.awt.Graphics2D g2)
      Draws the points defining the line on the specified Graphics2D context.
      void fillPt​(java.awt.Graphics2D g2)
      Fills the points defining the line with white color on the specified Graphics2D context.
      CPoint[] getMaxMinPoint()
      Gets the maximum and minimum points defining the line.
      void setDrawInfinite​(boolean inf)
      Sets whether the line should be drawn infinitely.
      void setInFlashMode​(boolean t)
      Sets the flashing mode for all points defining the line.
      • Methods inherited from class java.lang.Object

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

      • JLine

        public JLine()
        Constructs a new JLine.
    • Method Detail

      • setDrawInfinite

        public void setDrawInfinite​(boolean inf)
        Sets whether the line should be drawn infinitely.
        Parameters:
        inf - true to draw the line infinitely, false otherwise
      • addAPoint

        public void addAPoint​(CPoint p)
        Adds a point to the list of points defining the line.
        Parameters:
        p - the point to add
      • draw

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

        public void drawLine​(java.awt.Graphics2D g2)
        Draws the line between the maximum and minimum points on the specified Graphics2D context.
        Parameters:
        g2 - the Graphics2D context to draw on
      • drawPt

        public void drawPt​(java.awt.Graphics2D g2)
        Draws the points defining the line on the specified Graphics2D context.
        Parameters:
        g2 - the Graphics2D context to draw on
      • fillPt

        public void fillPt​(java.awt.Graphics2D g2)
        Fills the points defining the line with white color on the specified Graphics2D context.
        Parameters:
        g2 - the Graphics2D context to draw on
      • setInFlashMode

        public void setInFlashMode​(boolean t)
        Sets the flashing mode for all points defining the line.
        Parameters:
        t - true to enable flashing mode, false to disable
      • containPt

        public boolean containPt​(CPoint pt)
        Checks if the specified point is contained in the list of points defining the line.
        Parameters:
        pt - the point to check
        Returns:
        true if the point is contained in the list, false otherwise
      • getMaxMinPoint

        public CPoint[] getMaxMinPoint()
        Gets the maximum and minimum points defining the line.
        Returns:
        an array containing the maximum and minimum points, or null if there are less than two points