Package doodlepad
Class Line
java.lang.Object
doodlepad.Shape
doodlepad.Line
A class that implements a graphical straight line shape.
-
Nested Class Summary
Nested classes/interfaces inherited from class doodlepad.Shape
Shape.ShapeMouseEventHandler, Shape.ShapeSelectionEventHandler
-
Field Summary
Fields inherited from class doodlepad.Shape
draggable, eventsEnabled, fillColor, filled, font, fontFamily, fontSize, fontStyle, height, layer, selectable, selected, shapeListener, strokeColor, stroked, strokeWidth, text, textFillColor, transform, visible, width, x, y
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(Graphics2D g) Draw the Line objectgetArea()
Complete the area of the Line objectvoid
setPoints
(double x1, double y1, double x2, double y2) Set new endpoint locations for the Line objecttoString()
Generate a representation of the Line object.Methods inherited from class doodlepad.Shape
contains, contains, drawText, getCenter, getDraggable, getEventsEnabled, getFillAlpha, getFillBlue, getFillColor, getFilled, getFillGreen, getFillRed, getFontFamily, getFontSize, getFontStyle, getHeight, getLayer, getLocation, getPad, getPadLocation, getSelectable, getSelected, getSize, getStrokeAlpha, getStrokeBlue, getStrokeColor, getStroked, getStrokeGreen, getStrokeRed, getStrokeWidth, getText, getTransform, getVisible, getWidth, getWindowLocation, getX, getY, intersects, move, onMouseClicked, onMouseDoubleClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onSelectionChanged, repaint, reset, rotate, rotate, scale, scale, scale, scale, setCenter, setCenter, setDraggable, setEventsEnabled, setFillColor, setFillColor, setFillColor, setFillColor, setFilled, setFontFamily, setFontSize, setFontStyle, setHeight, setLocation, setLocation, setMouseClickedHandler, setMouseDoubleClickedHandler, setMouseDraggedHandler, setMouseEnteredHandler, setMouseExitedHandler, setMouseMovedHandler, setMousePressedHandler, setMouseReleasedHandler, setPadLocation, setSelectable, setSelected, setSelectionChangedHandler, setSize, setSize, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeColor, setStroked, setStrokeWidth, setText, setTextColor, setTextColor, setTextColor, setTextColor, setTransform, setVisible, setWidth, setWindowLocation, setX, setY, toBack, toFront, toWindowCoords, toWindowCoords, translate
-
Constructor Details
-
Line
public Line(double x1, double y1, double x2, double y2) Line object constructor.- Parameters:
x1
- The x-coordinate of the Line object's first point.y1
- The y-coordinate of the Line object's first point.x2
- The x-coordinate of the Line object's second point.y2
- The y-coordinate of the Line object's second point.
-
Line
Line object constructor.- Parameters:
x1
- The x-coordinate of the Line object's first point.y1
- The y-coordinate of the Line object's first point.x2
- The x-coordinate of the Line object's second point.y2
- The y-coordinate of the Line object's second point.pad
- The Pad object to which this Line should be added.
-
Line
Line object constructor.- Parameters:
x1
- The x-coordinate of the Line object's first point.y1
- The y-coordinate of the Line object's first point.x2
- The x-coordinate of the Line object's second point.y2
- The y-coordinate of the Line object's second point.layer
- The Layer object to which the Line should be added, or null if not to add to a Layer.
-
Line
public Line()Default constructor for the Line object. Creates a new 100x100 draggable shape and positions it randomly.
-
-
Method Details
-
setPoints
public void setPoints(double x1, double y1, double x2, double y2) Set new endpoint locations for the Line object- Parameters:
x1
- The x-coordinate of the line's first point.y1
- The y-coordinate of the line's first point.x2
- The x-coordinate of the line's second point.y2
- The y-coordinate of the line's second point.
-
toString
Generate a representation of the Line object. -
draw
Draw the Line object -
getArea
Complete the area of the Line object
-