|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.geom.Line2D
java.awt.geom.Line2D.Double
edu.neu.ccs.XLine2D
Class XLine2D extends Line2D.Double in
order to provide a much shorter name that does not explicitly refer
to an inner class and to support Stringable.
| Nested Class Summary |
| Nested classes inherited from class java.awt.geom.Line2D |
Line2D.Double, Line2D.Float |
| Field Summary | |
private static String[] |
BLANK
The data array with blank names "", "", "", "". |
protected SwingPropertyChangeSupport |
changeAdapter
Helper object for property change API. |
static String |
standardMessage
The standard error message for fromStringData. |
private static String[] |
X1Y1X2Y2
The data array with names "x1", "y1", "x2", "y2". |
| Fields inherited from class java.awt.geom.Line2D.Double |
x1, x2, y1, y2 |
| 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 | |
XLine2D()
Constructs a default XLine2D. |
|
XLine2D(double x1,
double y1,
double x2,
double y2)
Constructs an XLine2D using the given
double values. |
|
XLine2D(Line2D line)
Constructs an XLine2D using the given
Line2D value. |
|
XLine2D(Point2D p1,
Point2D p2)
Constructs an XLine2D using the given
Point2D values. |
|
XLine2D(String data)
Constructs an XLine2D object from
a String representation of the data state. |
|
| 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. |
double |
angleInDegrees()
Computes the angle in degrees of the line from the positive x-axis. |
double |
angleInRadians()
Computes the angle in radians of the line from the positive x-axis. |
void |
fromStringData(String data)
Defines the data state for this XLine2D object
from a String representation of the data state. |
double |
length()
Computes the length of the line, that is, the distance from x1,y1 to x2,y2. |
double |
lengthSq()
Computes the length squared of the line, that is, the distance squared from x1,y1 to x2,y2. |
void |
move(double dx,
double dy)
Moves the line by a translation using the data in the point specified by coordinates. |
void |
move(Point2D p)
Moves the line 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 |
setLine(double x1,
double y1,
double x2,
double y2)
Sets this line to the given values. |
void |
setLine(Line2D line)
Sets this line to the given value. |
void |
setLine(Point2D p1,
Point2D p2)
Sets this line to the given values. |
void |
setValue(double x1,
double y1,
double x2,
double y2)
Sets this line to the given values. |
void |
setValue(Line2D line)
Sets this line to the given value. |
void |
setValue(Point2D p1,
Point2D p2)
Sets this line to the given values. |
String |
toString()
Returns a human readable String representing
the data state of this XLine2D as an annotated
string. |
String |
toStringData()
Returns a human readable String representing
the data state of this XLine2D as a simple
string. |
| Methods inherited from class java.awt.geom.Line2D.Double |
getBounds2D, getP1, getP2, getX1, getX2, getY1, getY2 |
| Methods inherited from class java.awt.geom.Line2D |
clone, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW |
| 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[] X1Y1X2Y2
public static final String standardMessage
protected SwingPropertyChangeSupport changeAdapter
| Constructor Detail |
public XLine2D()
XLine2D.
public XLine2D(Line2D line)
XLine2D using the given
Line2D value.
line - the line to be copied
public XLine2D(Point2D p1,
Point2D p2)
XLine2D using the given
Point2D values.
p1 - point 1p2 - point 2
public XLine2D(double x1,
double y1,
double x2,
double y2)
XLine2D using the given
double values.
x1 - the x-coordinate of point 1y1 - the y-coordinate of point 1x2 - the x-coordinate of point 2y2 - the y-coordinate of point 2
public XLine2D(String data)
throws ParseException
XLine2D object from
a String representation of the data state.
data - String representation of the data state
ParseException - if the data is malformed| Method Detail |
public String toString()
Returns a human readable String representing
the data state of this XLine2D as an annotated
string.
XLine2D[x1=...;y1=...;x2=...;y2=...]
where the dots stand for the x1,y1,x2,y2 coordinate data.
public String toStringData()
Returns a human readable String representing
the data state of this XLine2D as a simple
string.
[...;...;...;...]
where the dots stand for the x1,y1,x2,y2 coordinate data.
toStringData in interface StringableStringable.fromStringData(String)
public void fromStringData(String data)
throws ParseException
Defines the data state for this XLine2D object
from a String representation of the data state.
Fires property change VALUE.
fromStringData in interface Stringabledata - String representation of the data state
ParseException - if the data is malformedStringable.toStringData()public void setValue(Line2D line)
Sets this line to the given value.
Fires property change VALUE.
line - the line to copy
public void setValue(Point2D p1,
Point2D p2)
Sets this line to the given values.
Fires property change VALUE.
p1 - point 1p2 - point 2
public void setValue(double x1,
double y1,
double x2,
double y2)
Sets this line to the given values.
Fires property change VALUE.
x1 - the x-coordinate of point 1y1 - the y-coordinate of point 1x2 - the x-coordinate of point 2y2 - the y-coordinate of point 2public void setLine(Line2D line)
Sets this line to the given value.
Fires property change VALUE.
line - the line to copy
public void setLine(Point2D p1,
Point2D p2)
Sets this line to the given values.
Fires property change VALUE.
p1 - point 1p2 - point 2
public void setLine(double x1,
double y1,
double x2,
double y2)
Sets this line to the given values.
Fires property change VALUE.
x1 - the x-coordinate of point 1y1 - the y-coordinate of point 1x2 - the x-coordinate of point 2y2 - the y-coordinate of point 2
public void move(double dx,
double dy)
Moves the line by a translation using the data in the point specified by coordinates.
dx - the x-coordinate of the translationdy - the y-coordinate of the translationpublic void move(Point2D p)
Moves the line by a translation using the data in the point.
p - the translation vectorpublic double length()
public double lengthSq()
public double angleInRadians()
public double angleInDegrees()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener - the listener to be registered
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
propertyName - the name of the desired propertylistener - the listener to be registeredpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener - the listener to be deregistered
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
propertyName - 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 | |||||||||