Methods Summary |
---|
protected void | firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
// Strings get interned...
if (propertyName=="text")
super.firePropertyChange(propertyName, oldValue, newValue);
|
public void | firePropertyChange(java.lang.String propertyName, byte oldValue, byte newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | firePropertyChange(java.lang.String propertyName, char oldValue, char newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | firePropertyChange(java.lang.String propertyName, short oldValue, short newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | firePropertyChange(java.lang.String propertyName, long oldValue, long newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | firePropertyChange(java.lang.String propertyName, float oldValue, float newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | firePropertyChange(java.lang.String propertyName, double oldValue, double newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public java.awt.Color | getBackgroundNonSelectionColor()Returns the background color to be used for non selected nodes.
return backgroundNonSelectionColor;
|
public java.awt.Color | getBackgroundSelectionColor()Returns the color to use for the background if node is selected.
return backgroundSelectionColor;
|
public java.awt.Color | getBorderSelectionColor()Returns the color the border is drawn.
return borderSelectionColor;
|
public javax.swing.Icon | getClosedIcon()Returns the icon used to represent non-leaf nodes that are not
expanded.
return closedIcon;
|
public javax.swing.Icon | getDefaultClosedIcon()Returns the default icon, for the current laf, that is used to
represent non-leaf nodes that are not expanded.
return UIManager.getIcon("Tree.closedIcon");
|
public javax.swing.Icon | getDefaultLeafIcon()Returns the default icon, for the current laf, that is used to
represent leaf nodes.
return UIManager.getIcon("Tree.leafIcon");
|
public javax.swing.Icon | getDefaultOpenIcon()Returns the default icon, for the current laf, that is used to
represent non-leaf nodes that are expanded.
return UIManager.getIcon("Tree.openIcon");
|
public java.awt.Font | getFont()Gets the font of this component.
Font font = super.getFont();
if (font == null && tree != null) {
// Strive to return a non-null value, otherwise the html support
// will typically pick up the wrong font in certain situations.
font = tree.getFont();
}
return font;
|
private int | getLabelStart()
Icon currentI = getIcon();
if(currentI != null && getText() != null) {
return currentI.getIconWidth() + Math.max(0, getIconTextGap() - 1);
}
return 0;
|
public javax.swing.Icon | getLeafIcon()Returns the icon used to represent leaf nodes.
return leafIcon;
|
public javax.swing.Icon | getOpenIcon()Returns the icon used to represent non-leaf nodes that are expanded.
return openIcon;
|
public java.awt.Dimension | getPreferredSize()Overrides JComponent.getPreferredSize to
return slightly wider preferred size value.
Dimension retDimension = super.getPreferredSize();
if(retDimension != null)
retDimension = new Dimension(retDimension.width + 3,
retDimension.height);
return retDimension;
|
public java.awt.Color | getTextNonSelectionColor()Returns the color the text is drawn with when the node isn't selected.
return textNonSelectionColor;
|
public java.awt.Color | getTextSelectionColor()Returns the color the text is drawn with when the node is selected.
return textSelectionColor;
|
public java.awt.Component | getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)Configures the renderer based on the passed in components.
The value is set from messaging the tree with
convertValueToText , which ultimately invokes
toString on value .
The foreground color is set based on the selection and the icon
is set based on on leaf and expanded.
String stringValue = tree.convertValueToText(value, sel,
expanded, leaf, row, hasFocus);
this.tree = tree;
this.hasFocus = hasFocus;
setText(stringValue);
if(sel)
setForeground(getTextSelectionColor());
else
setForeground(getTextNonSelectionColor());
// There needs to be a way to specify disabled icons.
if (!tree.isEnabled()) {
setEnabled(false);
if (leaf) {
setDisabledIcon(getLeafIcon());
} else if (expanded) {
setDisabledIcon(getOpenIcon());
} else {
setDisabledIcon(getClosedIcon());
}
}
else {
setEnabled(true);
if (leaf) {
setIcon(getLeafIcon());
} else if (expanded) {
setIcon(getOpenIcon());
} else {
setIcon(getClosedIcon());
}
}
setComponentOrientation(tree.getComponentOrientation());
selected = sel;
return this;
|
public void | invalidate()Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | paint(java.awt.Graphics g)Paints the value. The background is filled based on selected.
Color bColor;
if(selected) {
bColor = getBackgroundSelectionColor();
} else {
bColor = getBackgroundNonSelectionColor();
if(bColor == null)
bColor = getBackground();
}
int imageOffset = -1;
if(bColor != null) {
Icon currentI = getIcon();
imageOffset = getLabelStart();
g.setColor(bColor);
if(getComponentOrientation().isLeftToRight()) {
g.fillRect(imageOffset, 0, getWidth() - imageOffset,
getHeight());
} else {
g.fillRect(0, 0, getWidth() - imageOffset,
getHeight());
}
}
if (hasFocus) {
if (drawsFocusBorderAroundIcon) {
imageOffset = 0;
}
else if (imageOffset == -1) {
imageOffset = getLabelStart();
}
if(getComponentOrientation().isLeftToRight()) {
paintFocus(g, imageOffset, 0, getWidth() - imageOffset,
getHeight());
} else {
paintFocus(g, 0, 0, getWidth() - imageOffset, getHeight());
}
}
super.paint(g);
|
private void | paintFocus(java.awt.Graphics g, int x, int y, int w, int h)
Color bsColor = getBorderSelectionColor();
if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
g.setColor(bsColor);
g.drawRect(x, y, w - 1, h - 1);
}
if (drawDashedFocusIndicator) {
Color color;
if (selected) {
color = getBackgroundSelectionColor();
} else {
color = getBackgroundNonSelectionColor();
if(color == null) {
color = getBackground();
}
}
if (treeBGColor != color) {
treeBGColor = color;
focusBGColor = new Color(~color.getRGB());
}
g.setColor(focusBGColor);
BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
}
|
public void | repaint(long tm, int x, int y, int width, int height)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | repaint(java.awt.Rectangle r)Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | repaint()Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | revalidate()Overridden for performance reasons.
See the Implementation Note
for more information.
|
public void | setBackground(java.awt.Color color)Subclassed to map ColorUIResource s to null. If
color is null, or a ColorUIResource , this
has the effect of letting the background color of the JTree show
through. On the other hand, if color is non-null, and not
a ColorUIResource , the background becomes
color .
if(color instanceof ColorUIResource)
color = null;
super.setBackground(color);
|
public void | setBackgroundNonSelectionColor(java.awt.Color newColor)Sets the background color to be used for non selected nodes.
backgroundNonSelectionColor = newColor;
|
public void | setBackgroundSelectionColor(java.awt.Color newColor)Sets the color to use for the background if node is selected.
backgroundSelectionColor = newColor;
|
public void | setBorderSelectionColor(java.awt.Color newColor)Sets the color to use for the border.
borderSelectionColor = newColor;
|
public void | setClosedIcon(javax.swing.Icon newIcon)Sets the icon used to represent non-leaf nodes that are not expanded.
closedIcon = newIcon;
|
public void | setFont(java.awt.Font font)Subclassed to map FontUIResource s to null. If
font is null, or a FontUIResource , this
has the effect of letting the font of the JTree show
through. On the other hand, if font is non-null, and not
a FontUIResource , the font becomes font .
if(font instanceof FontUIResource)
font = null;
super.setFont(font);
|
public void | setLeafIcon(javax.swing.Icon newIcon)Sets the icon used to represent leaf nodes.
leafIcon = newIcon;
|
public void | setOpenIcon(javax.swing.Icon newIcon)Sets the icon used to represent non-leaf nodes that are expanded.
openIcon = newIcon;
|
public void | setTextNonSelectionColor(java.awt.Color newColor)Sets the color the text is drawn with when the node isn't selected.
textNonSelectionColor = newColor;
|
public void | setTextSelectionColor(java.awt.Color newColor)Sets the color the text is drawn with when the node is selected.
textSelectionColor = newColor;
|
public void | validate()Overridden for performance reasons.
See the Implementation Note
for more information.
|