|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.geom.Star2D
public class Star2D
This class provides a star shape. A star is defined by two radii and a number of branches. Each branch spans between the two radii. The inner radius is the distance between the center of the star and the origin of the branches. The outer radius is the distance between the center of the star and the tips of the branches.
Constructor Summary | |
---|---|
Star2D(double x,
double y,
double innerRadius,
double outerRadius,
int branchesCount)
Creates a new star whose center is located at the specified x and y coordinates. |
Method Summary | |
---|---|
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(java.awt.geom.Point2D p)
|
boolean |
contains(java.awt.geom.Rectangle2D r)
|
java.awt.Rectangle |
getBounds()
|
java.awt.geom.Rectangle2D |
getBounds2D()
|
int |
getBranchesCount()
Returns the number of branches of the star. |
double |
getInnerRadius()
Returns the distance between the center of the star and the origin of the branches. |
double |
getOuterRadius()
Returns the distance between the center of the star and the tips of the branches. |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at)
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
|
double |
getX()
Returns the location of the center of star. |
double |
getY()
Returns the location of the center of star. |
boolean |
intersects(double x,
double y,
double w,
double h)
|
boolean |
intersects(java.awt.geom.Rectangle2D r)
|
void |
setBranchesCount(int branchesCount)
Sets the number branches of the star. |
void |
setInnerRadius(double innerRadius)
Sets the inner radius of the star, that is the distance between its center and the origin of the branches. |
void |
setOuterRadius(double outerRadius)
Sets the outer radius of the star, that is the distance between its center and the tips of the branches. |
void |
setX(double x)
Sets location of the center of the star. |
void |
setY(double y)
Sets the location of the center of the star. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Star2D(double x, double y, double innerRadius, double outerRadius, int branchesCount)
Creates a new star whose center is located at the specified
x
and y
coordinates. The number of branches
and their length can be specified.
x
- the location of the star centery
- the location of the star centerinnerRadius
- the distance between the center of the star and the
origin of the branchesouterRadius
- the distance between the center of the star and the
tip of the branchesbranchesCount
- the number of branches in this star; must be >= 3
java.lang.IllegalArgumentException
- if branchesCount is < 3 or
if innerRadius
is >= outerRadius
Method Detail |
---|
public void setInnerRadius(double innerRadius)
Sets the inner radius of the star, that is the distance between its center and the origin of the branches. The inner radius must always be lower than the outer radius.
innerRadius
- the distance between the center of the star and the
origin of the branches
java.lang.IllegalArgumentException
- if the inner radius is >= outer radiuspublic void setX(double x)
Sets location of the center of the star.
x
- the x location of the center of the starpublic void setY(double y)
Sets the location of the center of the star.
y
- the x location of the center of the starpublic void setOuterRadius(double outerRadius)
Sets the outer radius of the star, that is the distance between its center and the tips of the branches. The outer radius must always be greater than the inner radius.
outerRadius
- the distance between the center of the star and the
tips of the branches
java.lang.IllegalArgumentException
- if the inner radius is >= outer radiuspublic void setBranchesCount(int branchesCount)
Sets the number branches of the star. A star must always have at least 3 branches.
branchesCount
- the number of branches
java.lang.IllegalArgumentException
- if branchesCount
is <=2public double getX()
Returns the location of the center of star.
public double getY()
Returns the location of the center of star.
public double getInnerRadius()
Returns the distance between the center of the star and the origin of the branches.
public double getOuterRadius()
Returns the distance between the center of the star and the tips of the branches.
public int getBranchesCount()
Returns the number of branches of the star.
public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
public boolean contains(double x, double y)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
public boolean intersects(java.awt.geom.Rectangle2D r)
intersects
in interface java.awt.Shape
public boolean contains(double x, double y, double w, double h)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Rectangle2D r)
contains
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |