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
    • Constructor Detail

      • 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 Detail

      • 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
      • 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
      • 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
      • 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
      • 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.