|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.display.DrawableShape
public class DrawableShape
A class that draws shapes using the Java 2D API.
| Field Summary | |
|---|---|
java.awt.Color |
color
|
java.awt.Color |
edgeColor
|
java.lang.String |
shapeClass
|
| Constructor Summary | |
|---|---|
DrawableShape(java.awt.Shape shape,
double x,
double y)
Constructs a DrawableShape with the given coordinates. |
|
| Method Summary | |
|---|---|
static DrawableShape |
createCircle(double x,
double y,
double d)
Creates a drawable circle. |
static DrawableShape |
createRectangle(double x,
double y,
double w,
double h)
Creates a drawable rectangle. |
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws the shape. |
static XML.ObjectLoader |
getLoader()
Gets the XML object loader for this class. |
double |
getTheta()
Gets the value of the roation angle theta. |
double |
getX()
Gets the value of x. |
double |
getY()
Gets the value of y. |
void |
setMarkerColor(java.awt.Color fillColor,
java.awt.Color edgeColor)
Sets the shape's drawing colors. |
void |
setTheta(double theta)
Sets the rotation angle in radians. |
void |
setX(double _x)
Sets the x coordinate. |
void |
setXY(double _x,
double _y)
Sets the x and y coordinates. |
void |
setY(double _y)
Sets the y coordinate. |
java.lang.String |
toString()
Returns a string representation of the circle. |
void |
tranform(double[][] mat)
Transforms the shape using the given matrix. |
void |
transform(java.awt.geom.AffineTransform transformation)
Transforms the shape using the given transformation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public java.awt.Color color
public java.awt.Color edgeColor
public java.lang.String shapeClass
| Constructor Detail |
|---|
public DrawableShape(java.awt.Shape shape,
double x,
double y)
shape - x - coordinatey - coordinate| Method Detail |
|---|
public static DrawableShape createCircle(double x,
double y,
double d)
x - y - d - the diameter
public static DrawableShape createRectangle(double x,
double y,
double w,
double h)
x - y - w - h -
public void setMarkerColor(java.awt.Color fillColor,
java.awt.Color edgeColor)
fillColor - edgeColor - public void setTheta(double theta)
theta - the new anglepublic double getTheta()
public void transform(java.awt.geom.AffineTransform transformation)
transformation - AffineTransformpublic void tranform(double[][] mat)
mat - double[][]
public void setXY(double _x,
double _y)
_x - _y - public void setX(double _x)
_x - public double getX()
public void setY(double _y)
_y - public double getY()
public java.lang.String toString()
toString in class java.lang.Object
public void draw(DrawingPanel panel,
java.awt.Graphics g)
draw in interface Drawablepanel - DrawingPanelg - Graphicspublic static XML.ObjectLoader getLoader()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||