public class CircleNode extends java.lang.Object implements Node
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
color |
private static int |
DEFAULT_SIZE |
private double |
size |
private double |
x |
private double |
y |
Constructor and Description |
---|
CircleNode(java.awt.Color aColor)
Construct a circle node with a given size and color.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
boolean |
contains(java.awt.geom.Point2D p)
Tests whether the node contains a point.
|
void |
draw(java.awt.Graphics2D g2)
Draw the node.
|
java.awt.geom.Rectangle2D |
getBounds()
Get the bounding rectangle of the shape of this node
|
java.awt.Color |
getColor() |
java.awt.geom.Point2D |
getConnectionPoint(java.awt.geom.Point2D other)
Get the best connection point to connect this node
with another node.
|
void |
setColor(java.awt.Color aColor) |
void |
translate(double dx,
double dy)
Translates the node by a given amount.
|
private double x
private double y
private double size
private java.awt.Color color
private static final int DEFAULT_SIZE
public CircleNode(java.awt.Color aColor)
aColor
- the fill colorpublic void setColor(java.awt.Color aColor)
public java.awt.Color getColor()
public java.lang.Object clone()
public void draw(java.awt.Graphics2D g2)
Node
public void translate(double dx, double dy)
Node
public boolean contains(java.awt.geom.Point2D p)
Node
public java.awt.geom.Rectangle2D getBounds()
Node
public java.awt.geom.Point2D getConnectionPoint(java.awt.geom.Point2D other)
Node
getConnectionPoint
in interface Node
other
- an exterior point that is to be joined
with this node