|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.geom.Point2D java.awt.geom.Point2D.Double org.opensourcephysics.media.core.TPoint org.opensourcephysics.media.core.TShape
public class TShape
This is the base class for all TPoint objects that draw a Shape.
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 | |
---|---|
protected java.awt.Color |
color
|
protected java.awt.Shape |
fillShape
|
protected static java.awt.Rectangle |
hitRect
|
protected java.awt.BasicStroke |
stroke
|
protected boolean |
visible
|
Fields inherited from class org.opensourcephysics.media.core.TPoint |
---|
coordinateStrBuilder, coordsEditTrigger, coordsVisibleInMouseBox, enabled, screenPt, stepEditTrigger, support, trackEditTrigger, worldPt |
Fields inherited from class java.awt.geom.Point2D.Double |
---|
x, y |
Constructor Summary | |
---|---|
TShape()
Constructs a TPoint object with coordinates (0, 0). |
|
TShape(double x,
double y)
Constructs a TPoint object with specified image coordinates. |
|
TShape(java.awt.geom.Point2D point)
Constructs a TPoint object with image coordinates specified by a Point2D (commonly another TPoint). |
Method Summary | |
---|---|
void |
draw(DrawingPanel panel,
java.awt.Graphics _g)
Overrides TPoint draw method. |
Interactive |
findInteractive(DrawingPanel panel,
int xpix,
int ypix)
Overrides TPoint findInteractive method. |
java.awt.Rectangle |
getBounds(VideoPanel vidPanel)
Gets the screen bounds of the shape. |
java.awt.Color |
getColor()
Gets the color of the shape. |
protected java.awt.Shape |
getShape(VideoPanel vidPanel)
Gets the shape to be filled in the draw method. |
java.awt.BasicStroke |
getStroke()
Gets the stroke. |
boolean |
isVisible()
Gets the current visible state. |
void |
setColor(java.awt.Color color)
Sets the color of the shape. |
protected void |
setHitRectCenter(int xpix,
int ypix)
Centers the hit testing rectangle on the specified screen point. |
void |
setStroke(java.awt.BasicStroke stroke)
Sets the stroke. |
void |
setVisible(boolean visible)
Sets the visible state. |
java.lang.String |
toString()
Returns a String describing this TPoint. |
Methods inherited from class org.opensourcephysics.media.core.TPoint |
---|
addPropertyChangeListener, addPropertyChangeListener, angle, angle, center, cos, cos, equals, getFrameNumber, getScreenPosition, getWorldPosition, getXMax, getXMin, getYMax, getYMin, isCoordsEditTrigger, isEnabled, isMeasured, isStepEditTrigger, isTrackEditTrigger, removePropertyChangeListener, removePropertyChangeListener, setCoordsEditTrigger, setEnabled, setLocation, setPositionOnLine, setScreenPosition, setScreenPosition, setStepEditTrigger, setTrackEditTrigger, setX, setXY, 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 |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.opensourcephysics.display.Interactive |
---|
getX, getY |
Field Detail |
---|
protected static java.awt.Rectangle hitRect
protected java.awt.Color color
protected boolean visible
protected java.awt.Shape fillShape
protected java.awt.BasicStroke stroke
Constructor Detail |
---|
public TShape()
public TShape(double x, double y)
x
- the x coordinatey
- the y coordinatepublic TShape(java.awt.geom.Point2D point)
point
- the Point2DMethod Detail |
---|
public void setColor(java.awt.Color color)
color
- the desired colorpublic java.awt.Color getColor()
public void setStroke(java.awt.BasicStroke stroke)
stroke
- the desired strokepublic java.awt.BasicStroke getStroke()
public java.awt.Rectangle getBounds(VideoPanel vidPanel)
getBounds
in class TPoint
vidPanel
- the video panel
public void setVisible(boolean visible)
visible
- true
to make this visible.public boolean isVisible()
true
if this is visible.public void draw(DrawingPanel panel, java.awt.Graphics _g)
draw
in interface Drawable
draw
in class TPoint
panel
- the drawing panel requesting the drawing_g
- the graphics context on which to drawpublic Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
findInteractive
in interface Interactive
findInteractive
in class TPoint
panel
- the drawing panelxpix
- the x pixel position on the panelypix
- the y pixel position on the panel
public java.lang.String toString()
toString
in class TPoint
protected java.awt.Shape getShape(VideoPanel vidPanel)
vidPanel
- the video panel
protected void setHitRectCenter(int xpix, int ypix)
xpix
- the x pixel positionypix
- the y pixel position
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |