|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.RoundRectangle2D
java.awt.geom.RoundRectangle2D.Double
edu.neu.ccs.XRoundRect
edu.neu.ccs.XRoundSquare
Class XRoundSquare extends XRoundRect
but requires that its location be specifed by its center, its size
by an object radius, and its arc size by a common arc radius.
The side of the roundsquare is twice the object radius and is the value
returned by either getWidth or getHeight.
Inherited methods that would permit the caller to make the width and height have different values are overridden to do nothing.
| Nested Class Summary |
| Nested classes inherited from class java.awt.geom.RoundRectangle2D |
RoundRectangle2D.Double, RoundRectangle2D.Float |
| Field Summary | |
private double |
arcr
The arc radius. |
private static String[] |
BLANK
The data array with blank names "", "", "", "". |
protected SwingPropertyChangeSupport |
changeAdapter
Helper object for property change API. |
private double |
r
The radius. |
static String |
standardMessage
The standard error message for fromStringData. |
private static String[] |
XYRArc
The data array with names "xc", "yc", "r", "arcr". |
| Fields inherited from class edu.neu.ccs.XRoundRect |
|
| Fields inherited from class java.awt.geom.RoundRectangle2D.Double |
archeight, arcwidth, height, width, x, y |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Constructor Summary | |
XRoundSquare()
Constructs a new XRoundSquare initialized to center (0, 0),
inner radius 0, and arc radius 0. |
|
XRoundSquare(double r,
double arcr)
Constructs a new XRoundSquare initialized to center (0, 0)
and with the given inner radius r and arc radius arcr. |
|
XRoundSquare(double xc,
double yc,
double r,
double arcr)
Constructs and initializes an XRoundSquare from the specified
double coordinates. |
|
XRoundSquare(XRoundSquare roundsquare)
Constructs and initializes an XRoundSquare from the specified
XRoundSquare object. |
|
| Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Registers the given object to listen for property change events generated by this object. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Registers the given object to listen for property change events generated by this object with the given property name. |
void |
fromStringData(String data)
Defines the data state for this XRoundSquare object
from a String representation of the data state. |
double |
getArcRadius()
Returns the arc radius. |
double |
getRadius()
Returns the radius. |
void |
move(double dx,
double dy)
Moves the round square by a translation using the data in the point specified by coordinates. |
void |
move(Point2D p)
Moves the round square by a translation using the data in the point. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Deregisters the given object from listening for property change events generated by this object. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Deregisters the given object from listening for property change events generated by this object with the given property name. |
void |
setRoundSquare(XRoundSquare roundsquare)
Uses the data from the given roundsquare to set the parameters of this roundsquare. |
void |
setXYRArc(double xc,
double yc,
double r,
double arcr)
Sets the parameters of the XRoundSquare with error checking. |
void |
setXYWHArcs(double x,
double y,
double w,
double h,
double arcw,
double arch)
Overrides the inherited method to do nothing since a roundsquare cannot have a distinct width and height or a distinct arc width and arc height. |
String |
toString()
Returns a human readable String representing
the data state of this XRoundSquare as an annotated
string. |
String |
toStringData()
Returns a human readable String representing
the data state of this XRoundSquare as a simple
string. |
| Methods inherited from class edu.neu.ccs.XRoundRect |
setFrame, setFrame, setFrame, setRect, setRect, setRoundRect, setRoundRect, setX1Y1X2Y2, setXYRS, setXYRSArcs, setXYWH, toStringAsXYRSArcs |
| Methods inherited from class java.awt.geom.RoundRectangle2D.Double |
getArcHeight, getArcWidth, getBounds2D, getHeight, getWidth, getX, getY, isEmpty |
| Methods inherited from class java.awt.geom.RoundRectangle2D |
contains, contains, getPathIterator, intersects |
| Methods inherited from class java.awt.geom.RectangularShape |
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static String[] BLANK
private static String[] XYRArc
public static final String standardMessage
private double r
private double arcr
protected SwingPropertyChangeSupport changeAdapter
| Constructor Detail |
public XRoundSquare()
XRoundSquare initialized to center (0, 0),
inner radius 0, and arc radius 0.
public XRoundSquare(double xc,
double yc,
double r,
double arcr)
XRoundSquare from the specified
double coordinates. Calls setXYRArc.
xc - the proposed center x-coordinateyc - the proposed center y-coordinater - the proposed inner radiusarcr - the proposed arc radius
public XRoundSquare(double r,
double arcr)
Constructs a new XRoundSquare initialized to center (0, 0)
and with the given inner radius r and arc radius arcr.
Calls setXYRArc
r - the proposed inner radiusarcr - the proposed arc radiuspublic XRoundSquare(XRoundSquare roundsquare)
Constructs and initializes an XRoundSquare from the specified
XRoundSquare object. Calls setXYRArc indirectly.
Initializes to center (0, 0), inner radius 0, and arc radius 0 if the given
roundsquare is null.
roundsquare - the XRoundSquare object to copy| Method Detail |
public String toString()
Returns a human readable String representing
the data state of this XRoundSquare as an annotated
string.
XRoundSquare[xc=...;yc=...;r=...;arcr=...]
where the dots stand for the center data xc,yc, the inner radius r, and the arc radius arcr.
toString in class XRoundRectpublic String toStringData()
Returns a human readable String representing
the data state of this XRoundSquare as a simple
string.
[...;...;...;...]
where the dots stand for the center data xc,yc, the inner radius r, and the arc radius arcr.
toStringData in interface StringabletoStringData in class XRoundRect
public void fromStringData(String data)
throws ParseException
Defines the data state for this XRoundSquare object
from a String representation of the data state.
Fires property change VALUE.
fromStringData in interface StringablefromStringData in class XRoundRectdata - String representation of the data state
ParseException - if the data is malformed
public void setXYRArc(double xc,
double yc,
double r,
double arcr)
Sets the parameters of the XRoundSquare with error checking.
If the inner radius r is negative, it is replaced by its absolute value.
If the arc radius arcr is negative, it is replaced by its absolute value.
The arc radius is forced to be less than or equal to the inner radius.
The roundsquare is then set up as a round rectangle with center location xc,yc, common inner radius r, and common arc radius arcr.
Fires property change VALUE.
xc - the proposed center x-coordinateyc - the proposed center y-coordinater - the proposed inner radiusarcr - the proposed arc radiuspublic void setRoundSquare(XRoundSquare roundsquare)
Uses the data from the given roundsquare to set the parameters of this roundsquare.
Does nothing if the given roundsquare is null.
Fires property change VALUE.
roundsquare - the XRoundSquare object to copypublic double getRadius()
public double getArcRadius()
public void setXYWHArcs(double x,
double y,
double w,
double h,
double arcw,
double arch)
Overrides the inherited method to do nothing since a roundsquare cannot have a distinct width and height or a distinct arc width and arc height.
The fact that this method does nothing implies that the following methods
inherited from XRoundRect and other base classes also do nothing.
setXYRSArcssetXYWHsetXYRSsetX1Y1X2Y2setRectsetFramesetFrameFromCentersetFrameFromDiagonal
setXYWHArcs in class XRoundRectx - the proposed top-left x-coordinatey - the proposed top-left y-coordinatew - the proposed widthh - the proposed heightarcw - the proposed arc widtharch - the proposed arc height
public void move(double dx,
double dy)
Moves the round square by a translation using the data in the point specified by coordinates.
move in class XRoundRectdx - the x-coordinate of the translationdy - the y-coordinate of the translationpublic void move(Point2D p)
Moves the round square by a translation using the data in the point.
move in class XRoundRectp - the translation vectorpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener in class XRoundRectlistener - the listener to be registered
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
addPropertyChangeListener in class XRoundRectpropertyName - the name of the desired propertylistener - the listener to be registeredpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in class XRoundRectlistener - the listener to be deregistered
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
removePropertyChangeListener in class XRoundRectpropertyName - the name of the desired propertylistener - the listener to be deregistered
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||