| java.lang.Object org.jdesktop.swingx.geom.Star2D
Star2D | public class Star2D implements Shape(Code) | | 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.
author: Romain Guy |
Constructor Summary | |
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. |
Method Summary | |
public boolean | contains(double x, double y) | public boolean | contains(Point2D p) | public boolean | contains(double x, double y, double w, double h) | public boolean | contains(Rectangle2D r) | public Rectangle | getBounds() | public Rectangle2D | getBounds2D() | public int | getBranchesCount() | public double | getInnerRadius() | public double | getOuterRadius() | public PathIterator | getPathIterator(AffineTransform at) | public PathIterator | getPathIterator(AffineTransform at, double flatness) | public double | getX() | public double | getY() | public boolean | intersects(double x, double y, double w, double h) | public boolean | intersects(Rectangle2D r) | public void | setBranchesCount(int branchesCount) Sets the number branches of the star. | 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. | public void | setOuterRadius(double outerRadius) Sets the outer radius of the star, that is the distance between its
center and the tips of the branches. | public void | setX(double x) | public void | setY(double y) |
Star2D | public Star2D(double x, double y, double innerRadius, double outerRadius, int branchesCount)(Code) | | 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.
Parameters: x - the location of the star center Parameters: y - the location of the star center Parameters: innerRadius - the distance between the center of the star and theorigin of the branches Parameters: outerRadius - the distance between the center of the star and thetip of the branches Parameters: branchesCount - the number of branches in this star; must be >= 3 throws: IllegalArgumentException - if branchesCount is < 3 orif innerRadius is >= outerRadius |
contains | public boolean contains(double x, double y)(Code) | | |
contains | public boolean contains(double x, double y, double w, double h)(Code) | | |
getBranchesCount | public int getBranchesCount()(Code) | | Returns the number of branches of the star.
the number of branches, always >= 3 |
getInnerRadius | public double getInnerRadius()(Code) | | Returns the distance between the center of the star and the origin
of the branches.
the inner radius of the star |
getOuterRadius | public double getOuterRadius()(Code) | | Returns the distance between the center of the star and the tips
of the branches.
the outer radius of the star |
getX | public double getX()(Code) | | Returns the location of the center of star.
the x coordinate of the center of the star |
getY | public double getY()(Code) | | Returns the location of the center of star.
the y coordinate of the center of the star |
intersects | public boolean intersects(double x, double y, double w, double h)(Code) | | |
setBranchesCount | public void setBranchesCount(int branchesCount)(Code) | | Sets the number branches of the star. A star must always have at least
3 branches.
Parameters: branchesCount - the number of branches throws: IllegalArgumentException - if branchesCount is <=2 |
setInnerRadius | public void setInnerRadius(double innerRadius)(Code) | | 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.
Parameters: innerRadius - the distance between the center of the star and theorigin of the branches throws: IllegalArgumentException - if the inner radius is >= outer radius |
setOuterRadius | public void setOuterRadius(double outerRadius)(Code) | | 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.
Parameters: outerRadius - the distance between the center of the star and thetips of the branches throws: IllegalArgumentException - if the inner radius is >= outer radius |
setX | public void setX(double x)(Code) | | Sets location of the center of the star.
Parameters: x - the x location of the center of the star |
setY | public void setY(double y)(Code) | | Sets the location of the center of the star.
Parameters: y - the x location of the center of the star |
|
|