public class IconNodeRenderer extends java.lang.Object implements NodeRenderer, java.awt.image.ImageObserver
Constructor and Description |
---|
IconNodeRenderer(java.awt.Image iconImage)
Creates a new IconNodeRenderer object.
|
Modifier and Type | Method and Description |
---|---|
void |
drawNode(java.awt.Graphics g,
java.lang.Object node,
java.awt.Point loc)
Draws the node into the Graphics Context.
|
java.awt.Color |
getColor()
Gets the color for the Renderer, if any
|
protected java.awt.Image |
getIcon(java.lang.Object node)
Get the icon used to render the specified node.
|
java.awt.Rectangle |
getNodeBounds(java.lang.Object node,
java.awt.Point loc)
Returns the bounding box for the node using this renderer.
|
void |
highlightNode(java.awt.Graphics g,
java.lang.Object node,
java.awt.Point loc)
Highlights the node into the Graphics Context.
|
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
This method is called when information about an image which was
previously requested using an asynchronous interface becomes available.
|
boolean |
pickNode(java.lang.Object node,
java.awt.Point loc,
java.awt.Point pickPoint)
Checks whether the specified pickpoint is within the drawn area for the
node.
|
void |
setColor(java.awt.Color color)
Sets the color for the NodeRenderer.
|
void |
setIconScaleFlag(boolean scaleFlag)
Sets the flag indicating whether to scale the icon, or use the natural
icon size when displaying the icons.
|
void |
setIconSize(int size)
Sets the size of icon to be used.
|
void |
setShowNames(boolean show)
Sets the flag indicating whether the name of the node should be
displayed beneath the icon.
|
public IconNodeRenderer(java.awt.Image iconImage)
iconImage
- An icon to use for rendering the nodepublic void drawNode(java.awt.Graphics g, java.lang.Object node, java.awt.Point loc)
drawNode
in interface NodeRenderer
g
- the Graphics context to display the nodenode
- the node to displayloc
- The node locationpublic java.awt.Color getColor()
getColor
in interface NodeRenderer
protected java.awt.Image getIcon(java.lang.Object node)
node
- The node to renderpublic java.awt.Rectangle getNodeBounds(java.lang.Object node, java.awt.Point loc)
getNodeBounds
in interface NodeRenderer
node
- The node to be checkedloc
- The node locationpublic void highlightNode(java.awt.Graphics g, java.lang.Object node, java.awt.Point loc)
highlightNode
in interface NodeRenderer
g
- the Graphics context to display the nodenode
- the node to displayloc
- The node locationpublic boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface java.awt.image.ImageObserver
img
- the image being observed.infoflags
- the bitwise inclusive OR of the following flags: WIDTH,
HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR,
ABORT.x
- the x coordinate.y
- the y coordinate.width
- the width.height
- the height.public boolean pickNode(java.lang.Object node, java.awt.Point loc, java.awt.Point pickPoint)
pickNode
in interface NodeRenderer
node
- the node to check for pickingloc
- The node locationpickPoint
- the coordinate of the point to checkpublic void setColor(java.awt.Color color)
setColor
in interface NodeRenderer
color
- The color to use.public void setIconScaleFlag(boolean scaleFlag)
scaleFlag
- a flag indicating whether to resize the icons.public void setIconSize(int size)
size
- the size of the iconpublic void setShowNames(boolean show)
show
- flag indicating whether names are visible