|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.display.Spring
public class Spring
Draws a coil spring in a drawing panel.
Constructor Summary | |
---|---|
Spring()
Constructs a 0.1 radius Spring. |
|
Spring(double _radius)
Special constructor that allows to specify the radius of the spring |
Method Summary | |
---|---|
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Implementation of Drawable. |
java.awt.Color |
getEdgeColor()
|
java.awt.Stroke |
getEdgeStroke()
|
int |
getLoops()
|
int |
getPointsPerLoop()
|
double |
getRadius()
Get the radius of the spring. |
double |
getSizeX()
Gets the X size of the spring |
double |
getSizeY()
Gets the Y size of the spring |
double |
getX()
Gets the X position of the origin of the spring |
double |
getXMax()
Gets the maximum x needed to draw this object. |
double |
getXMin()
Gets the minimum x needed to draw this object. |
double |
getY()
Gets the Y position of the origin of the spring |
double |
getYMax()
Gets the maximum y needed to draw this object. |
double |
getYMin()
Gets the minimum y needed to draw this object. |
boolean |
isMeasured()
Determines if information is available to set min/max values. |
boolean |
isVisible()
|
void |
setEdgeColor(java.awt.Color color)
|
void |
setEdgeStroke(java.awt.Stroke stroke)
|
void |
setRadius(double radius)
Set the radius of the spring. |
void |
setResolution(int nLoops,
int nPointsPerLoop)
Sets the number of spires and points per spire used to draw the spring |
void |
setSizeX(double sizeX)
Sets the X size of the spring |
void |
setSizeXY(double sizeX,
double sizeY)
Sets the size of the spring |
void |
setSizeY(double sizeY)
Sets the Y size of the spring |
void |
setSolenoid(double factor)
Sets a double factor that makes the spring look like a solenoid by causing the spires to go back and forth Default is 0, which makes a standard spring |
void |
setThinExtremes(boolean thin)
Whether the spring should show thin extremes. |
void |
setVisible(boolean visible)
Sets the visibiliby of the spring |
void |
setX(double x)
Sets the X position of the origin of the spring |
void |
setXY(double x,
double y)
Sets the position of the origin of the spring |
void |
setY(double y)
Sets the Y position of the origin of the spring |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Spring()
public Spring(double _radius)
_radius
- the radius of the spring (normal to its direction)Method Detail |
---|
public void setX(double x)
x
- doublepublic double getX()
public void setY(double y)
y
- doublepublic double getY()
public void setXY(double x, double y)
x
- doubley
- doublepublic void setSizeX(double sizeX)
sizeX
- doublepublic double getSizeX()
public void setSizeY(double sizeY)
sizeY
- doublepublic double getSizeY()
public void setSizeXY(double sizeX, double sizeY)
sizeX
- doublesizeY
- doublepublic void setRadius(double radius)
_radius
- the radius of the spring (normal to its direction)public double getRadius()
public void setVisible(boolean visible)
_visible
- booleanpublic boolean isVisible()
public void setEdgeColor(java.awt.Color color)
public java.awt.Color getEdgeColor()
public void setEdgeStroke(java.awt.Stroke stroke)
public java.awt.Stroke getEdgeStroke()
public void setResolution(int nLoops, int nPointsPerLoop)
nLoops
- intnPointsPerLoop
- intpublic int getLoops()
public int getPointsPerLoop()
public void setSolenoid(double factor)
factor
- doublepublic void setThinExtremes(boolean thin)
thin
- booleanpublic void draw(DrawingPanel panel, java.awt.Graphics g)
draw
in interface Drawable
panel
- DrawingPanelg
- Graphicspublic boolean isMeasured()
Measurable
isMeasured
in interface Measurable
public double getXMin()
Measurable
getXMin
in interface Measurable
public double getXMax()
Measurable
getXMax
in interface Measurable
public double getYMin()
Measurable
getYMin
in interface Measurable
public double getYMax()
Measurable
getYMax
in interface Measurable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |