Package wprover
Class JLine
- java.lang.Object
-
- wprover.JLine
-
public class JLine extends java.lang.ObjectJLine 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 voidaddAPoint(CPoint p)Adds a point to the list of points defining the line.booleancontainPt(CPoint pt)Checks if the specified point is contained in the list of points defining the line.booleandraw(java.awt.Graphics2D g2)Draws the line on the specified Graphics2D context.voiddrawLine(java.awt.Graphics2D g2)Draws the line between the maximum and minimum points on the specified Graphics2D context.voiddrawPt(java.awt.Graphics2D g2)Draws the points defining the line on the specified Graphics2D context.voidfillPt(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.voidsetDrawInfinite(boolean inf)Sets whether the line should be drawn infinitely.voidsetInFlashMode(boolean t)Sets the flashing mode for all points defining the line.
-
-
-
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
-
-