Class Line

All Implemented Interfaces:
Styleable, EventTarget

public class Line
extends Shape
This Line represents a line segment in (x,y) coordinate space. Example:
import javafx.scene.shape.*;

Line line = new Line();
line.setStartX(0.0f);
line.setStartY(0.0f);
line.setEndX(100.0f);
line.setEndY(100.0f);
}
Since:
JavaFX 2.0
  • Property Details

  • Constructor Details

    • Line

      public Line()
      Creates an empty instance of Line.
    • Line

      public Line​(double startX, double startY, double endX, double endY)
      Creates a new instance of Line.
      Parameters:
      startX - the horizontal coordinate of the start point of the line segment
      startY - the vertical coordinate of the start point of the line segment
      endX - the horizontal coordinate of the end point of the line segment
      endY - the vertical coordinate of the end point of the line segment
  • Method Details

    • setStartX

      public final void setStartX​(double value)
      Sets the value of the property startX.
      Property description:
      The X coordinate of the start point of the line segment.
      Default value:
      0.0
    • getStartX

      public final double getStartX()
      Gets the value of the property startX.
      Property description:
      The X coordinate of the start point of the line segment.
      Default value:
      0.0
    • startXProperty

      public final DoubleProperty startXProperty()
      The X coordinate of the start point of the line segment.
      Default value:
      0.0
      See Also:
      getStartX(), setStartX(double)
    • setStartY

      public final void setStartY​(double value)
      Sets the value of the property startY.
      Property description:
      The Y coordinate of the start point of the line segment.
      Default value:
      0.0
    • getStartY

      public final double getStartY()
      Gets the value of the property startY.
      Property description:
      The Y coordinate of the start point of the line segment.
      Default value:
      0.0
    • startYProperty

      public final DoubleProperty startYProperty()
      The Y coordinate of the start point of the line segment.
      Default value:
      0.0
      See Also:
      getStartY(), setStartY(double)
    • setEndX

      public final void setEndX​(double value)
      Sets the value of the property endX.
      Property description:
      The X coordinate of the end point of the line segment.
      Default value:
      0.0
    • getEndX

      public final double getEndX()
      Gets the value of the property endX.
      Property description:
      The X coordinate of the end point of the line segment.
      Default value:
      0.0
    • endXProperty

      public final DoubleProperty endXProperty()
      The X coordinate of the end point of the line segment.
      Default value:
      0.0
      See Also:
      getEndX(), setEndX(double)
    • setEndY

      public final void setEndY​(double value)
      Sets the value of the property endY.
      Property description:
      The Y coordinate of the end point of the line segment.
      Default value:
      0.0
    • getEndY

      public final double getEndY()
      Gets the value of the property endY.
      Property description:
      The Y coordinate of the end point of the line segment.
      Default value:
      0.0
    • endYProperty

      public final DoubleProperty endYProperty()
      The Y coordinate of the end point of the line segment.
      Default value:
      0.0
      See Also:
      getEndY(), setEndY(double)
    • toString

      public String toString()
      Returns a string representation of this Line object.
      Overrides:
      toString in class Node
      Returns:
      a string representation of this Line object.