org.opensourcephysics.media.core
Class TLine

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by java.awt.geom.Point2D.Double
          extended by org.opensourcephysics.media.core.TPoint
              extended by org.opensourcephysics.media.core.TShape
                  extended by org.opensourcephysics.media.core.TLine
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Drawable, Interactive, Measurable, Trackable
Direct Known Subclasses:
TLineProfile

public class TLine
extends TShape

This is a TShape that draws a line.

Version:
1.0
Author:
Douglas Brown
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float
 
Field Summary
 
Fields inherited from class java.awt.geom.Point2D.Double
x, y
 
Constructor Summary
TLine()
          Constructs a default TLine with end points at (0, 0).
TLine(double x1, double y1, double x2, double y2)
          Constructs a TLine with specified end points.
 
Method Summary
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Returns the interactive drawable object at the specified pixel position.
 TPoint getEnd1()
          Gets end 1.
 TPoint getEnd2()
          Gets end 2.
 void setStroke(java.awt.BasicStroke stroke)
          Overrides TShape setStroke method.
 void setXY(double x, double y)
          Sets the x and y positions in imagespace.
 
Methods inherited from class org.opensourcephysics.media.core.TShape
draw, getBounds, getColor, getStroke, isVisible, setColor, setVisible, toString
 
Methods inherited from class org.opensourcephysics.media.core.TPoint
addPropertyChangeListener, addPropertyChangeListener, angle, angle, center, cos, cos, equals, getFrameNumber, getScreenPosition, getWorldPosition, getXMax, getXMin, getYMax, getYMin, isAdjusting, isAutotrackable, isCoordsEditTrigger, isEnabled, isMeasured, isStepEditTrigger, isTrackEditTrigger, removePropertyChangeListener, removePropertyChangeListener, setAdjusting, setCoordsEditTrigger, setEnabled, setLocation, setPositionOnLine, setScreenPosition, setScreenPosition, setStepEditTrigger, setTrackEditTrigger, setX, setY, showCoordinates, sin, sin, translate
 
Methods inherited from class java.awt.geom.Point2D.Double
getX, getY
 
Methods inherited from class java.awt.geom.Point2D
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Interactive
getX, getY
 

Constructor Detail

TLine

public TLine()
Constructs a default TLine with end points at (0, 0).


TLine

public TLine(double x1,
             double y1,
             double x2,
             double y2)
Constructs a TLine with specified end points.

Parameters:
x1 - x position of end 1
y1 - y position of end 1
x2 - x position of end 2
y2 - y position of end 2
Method Detail

getEnd1

public TPoint getEnd1()
Gets end 1.

Returns:
end 1

getEnd2

public TPoint getEnd2()
Gets end 2.

Returns:
end 2

setStroke

public void setStroke(java.awt.BasicStroke stroke)
Overrides TShape setStroke method.

Overrides:
setStroke in class TShape
Parameters:
stroke - the desired stroke

setXY

public void setXY(double x,
                  double y)
Sets the x and y positions in imagespace.

Specified by:
setXY in interface Interactive
Overrides:
setXY in class TPoint
Parameters:
x - the x position
y - the y position

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Returns the interactive drawable object at the specified pixel position.

Specified by:
findInteractive in interface Interactive
Overrides:
findInteractive in class TShape
Parameters:
panel - the drawing panel
xpix - the x pixel position on the panel
ypix - the y pixel position on the panel
Returns:
the interactive drawable object