public class DefaultTreeCellRenderer extends javax.swing.JLabel implements TreeCellRenderer
TreeCellRenderer interface.javax.swing.JLabel.AccessibleJLabeljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
protected java.awt.Color |
backgroundNonSelectionColor
The background color for non-selected cells.
|
protected java.awt.Color |
backgroundSelectionColor
The background color for selected cells.
|
protected java.awt.Color |
borderSelectionColor
The border color for selected tree cells.
|
protected javax.swing.Icon |
closedIcon
The icon used to represent non-leaf nodes that are closed.
|
protected boolean |
hasFocus
A flag indicating the current focus status.
|
protected javax.swing.Icon |
leafIcon
The icon used to represent leaf nodes.
|
protected javax.swing.Icon |
openIcon
The icon used to represent non-leaf nodes that are open.
|
protected boolean |
selected
A flag indicating the current selection status.
|
protected java.awt.Color |
textNonSelectionColor
The color used for text in non-selected cells.
|
protected java.awt.Color |
textSelectionColor
The color used for text in selected cells.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
DefaultTreeCellRenderer()
Creates a new tree cell renderer with defaults appropriate for the
current
LookAndFeel. |
| Modifier and Type | Method and Description |
|---|---|
void |
firePropertyChange(java.lang.String name,
boolean oldValue,
boolean newValue)
For performance reasons, this method is overridden to do nothing.
|
void |
firePropertyChange(java.lang.String name,
byte oldValue,
byte newValue)
For performance reasons, this method is overridden to do nothing.
|
void |
firePropertyChange(java.lang.String name,
char oldValue,
char newValue)
For performance reasons, this method is overridden to do nothing.
|
void |
firePropertyChange(java.lang.String name,
double oldValue,
double newValue)
For performance reasons, this method is overridden to do nothing.
|
void |
firePropertyChange(java.lang.String name,
float oldValue,
float newValue)
For performance reasons, this method is overridden to do nothing.
|
void |
firePropertyChange(java.lang.String name,
int oldValue,
int newValue)
For performance reasons, this method is overridden to do nothing.
|
void |
firePropertyChange(java.lang.String name,
long oldValue,
long newValue)
For performance reasons, this method is overridden to do nothing.
|
protected void |
firePropertyChange(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)
For performance reasons, this method is overridden to do nothing.
|
void |
firePropertyChange(java.lang.String name,
short oldValue,
short newValue)
For performance reasons, this method is overridden to do nothing.
|
java.awt.Color |
getBackgroundNonSelectionColor()
Returns the background color for tree cells that are not selected.
|
java.awt.Color |
getBackgroundSelectionColor()
Returns the background color for tree cells that are selected.
|
java.awt.Color |
getBorderSelectionColor()
Returns the border color for tree cells that are selected.
|
javax.swing.Icon |
getClosedIcon()
Returns the icon displayed for non-leaf nodes that are closed.
|
javax.swing.Icon |
getDefaultClosedIcon()
Returns the default icon for non-leaf tree cells that are closed (not
expanded).
|
javax.swing.Icon |
getDefaultLeafIcon()
Returns the default icon for leaf tree cells.
|
javax.swing.Icon |
getDefaultOpenIcon()
Returns the default icon for non-leaf tree cells that are open (expanded).
|
java.awt.Font |
getFont()
Returns the current font.
|
javax.swing.Icon |
getLeafIcon()
Returns the icon displayed for leaf nodes.
|
javax.swing.Icon |
getOpenIcon()
Returns the icon displayed for non-leaf nodes that are open (expanded).
|
java.awt.Dimension |
getPreferredSize()
Returns the preferred size of the cell.
|
java.awt.Color |
getTextNonSelectionColor()
Returns the text color for tree cells that are not selected.
|
java.awt.Color |
getTextSelectionColor()
Returns the text color for tree cells that are selected.
|
java.awt.Component |
getTreeCellRendererComponent(javax.swing.JTree tree,
java.lang.Object val,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Returns a component (in fact
this) that can be used to
render a tree cell with the specified state. |
void |
paint(java.awt.Graphics g)
Paints the value.
|
void |
repaint(long tm,
int x,
int y,
int width,
int height)
For performance reasons, this method is overridden to do nothing.
|
void |
repaint(java.awt.Rectangle area)
For performance reasons, this method is overridden to do nothing.
|
void |
revalidate()
For performance reasons, this method is overridden to do nothing.
|
void |
setBackground(java.awt.Color c)
Sets the background color.
|
void |
setBackgroundNonSelectionColor(java.awt.Color c)
Sets the background color for tree cells that are not selected.
|
void |
setBackgroundSelectionColor(java.awt.Color c)
Sets the background color for tree cells that are selected.
|
void |
setBorderSelectionColor(java.awt.Color c)
Sets the border color for tree cells that are selected.
|
void |
setClosedIcon(javax.swing.Icon icon)
Sets the icon to be displayed for non-leaf nodes that are closed.
|
void |
setFont(java.awt.Font f)
Sets the font.
|
void |
setLeafIcon(javax.swing.Icon icon)
Sets the icon to be displayed for leaf nodes.
|
void |
setOpenIcon(javax.swing.Icon icon)
Sets the icon to be displayed for non-leaf nodes that are open (expanded).
|
void |
setTextNonSelectionColor(java.awt.Color c)
Sets the text color for tree cells that are not selected.
|
void |
setTextSelectionColor(java.awt.Color c)
Sets the text color for tree cells that are selected.
|
void |
validate()
For performance reasons, this method is overridden to do nothing.
|
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected boolean selected
protected boolean hasFocus
protected transient javax.swing.Icon closedIcon
setClosedIcon(Icon)protected transient javax.swing.Icon leafIcon
setLeafIcon(Icon)protected transient javax.swing.Icon openIcon
setOpenIcon(Icon)protected java.awt.Color textSelectionColor
setTextSelectionColor(Color)protected java.awt.Color textNonSelectionColor
setTextNonSelectionColor(Color)protected java.awt.Color backgroundSelectionColor
setBackgroundSelectionColor(Color)protected java.awt.Color backgroundNonSelectionColor
protected java.awt.Color borderSelectionColor
setBorderSelectionColor(Color)public DefaultTreeCellRenderer()
LookAndFeel.public javax.swing.Icon getDefaultOpenIcon()
LookAndFeel using the key Tree.openIcon.public javax.swing.Icon getDefaultClosedIcon()
LookAndFeel using the key Tree.closedIcon.public javax.swing.Icon getDefaultLeafIcon()
LookAndFeel using the key
Tree.leafIcon.public void setOpenIcon(javax.swing.Icon icon)
null if no icon is required.icon - the icon (null permitted).getOpenIcon()public javax.swing.Icon getOpenIcon()
LookAndFeel.null).setOpenIcon(Icon)public void setClosedIcon(javax.swing.Icon icon)
null if no icon is required.icon - the icon (null permitted).getClosedIcon()public javax.swing.Icon getClosedIcon()
LookAndFeel.null).setClosedIcon(Icon)public void setLeafIcon(javax.swing.Icon icon)
null if no icon is required.icon - the icon (null permitted).getLeafIcon()public javax.swing.Icon getLeafIcon()
LookAndFeel.null).setLeafIcon(Icon)public void setTextSelectionColor(java.awt.Color c)
c - the color (null permitted).getTextSelectionColor()public java.awt.Color getTextSelectionColor()
LookAndFeel defaults
table using the key Tree.selectionForeground.setTextSelectionColor(Color)public void setTextNonSelectionColor(java.awt.Color c)
c - the color (null permitted).getTextNonSelectionColor()public java.awt.Color getTextNonSelectionColor()
LookAndFeel defaults
table using the key Tree.selectionForeground.#setTextgroundNonSelectionColor(Color)public void setBackgroundSelectionColor(java.awt.Color c)
c - the color (null permitted).getBackgroundSelectionColor()public java.awt.Color getBackgroundSelectionColor()
LookAndFeel defaults
table using the key Tree.selectionBackground.setBackgroundSelectionColor(Color)public void setBackgroundNonSelectionColor(java.awt.Color c)
c - the color (null permitted).getBackgroundNonSelectionColor()public java.awt.Color getBackgroundNonSelectionColor()
LookAndFeel defaults
table using the key Tree.textBackground.setBackgroundNonSelectionColor(Color)public void setBorderSelectionColor(java.awt.Color c)
c - the color (null permitted).getBorderSelectionColor()public java.awt.Color getBorderSelectionColor()
LookAndFeel defaults
table using the key Tree.selectionBorderColor.setBorderSelectionColor(Color)public void setFont(java.awt.Font f)
setFont in class javax.swing.JLabelf - the font.getFont()public void setBackground(java.awt.Color c)
setBackground in class javax.swing.JComponentc - the color.Component.getBackground()public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
this) that can be used to
render a tree cell with the specified state.getTreeCellRendererComponent in interface TreeCellRenderertree - the tree that the cell belongs to.val - the cell value.selected - indicates whether or not the cell is selected.expanded - indicates whether or not the cell is expanded.leaf - indicates whether or not the cell is a leaf in the tree.row - the row index.hasFocus - indicates whether or not the cell has the focus.this.public java.awt.Font getFont()
getFont in interface java.awt.MenuContainergetFont in class java.awt.ComponentsetFont(Font)public void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentg - the graphics device.JComponent.paintImmediately(Rectangle)public java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentComponent.setPreferredSize(java.awt.Dimension),
Component.getPreferredSize(),
Component.isPreferredSizeSet(),
ComponentUI.getPreferredSize(JComponent)public void validate()
validate in class java.awt.ContainerComponent.invalidate(),
Component.doLayout(),
LayoutManager,
Container.validate()public void revalidate()
revalidate in class javax.swing.JComponentpublic void repaint(long tm, int x, int y, int width, int height)
repaint in class javax.swing.JComponenttm - ignoredx - coordinate of the region to mark as dirtyy - coordinate of the region to mark as dirtywidth - dimension of the region to mark as dirtyheight - dimension of the region to mark as dirtyComponent.update(Graphics)public void repaint(java.awt.Rectangle area)
repaint in class javax.swing.JComponentarea - the area to repaint.protected void firePropertyChange(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
firePropertyChange in class java.awt.Componentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, byte oldValue, byte newValue)
firePropertyChange in class java.awt.Componentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, char oldValue, char newValue)
firePropertyChange in class java.awt.Componentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, short oldValue, short newValue)
firePropertyChange in class java.awt.Componentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, int oldValue, int newValue)
firePropertyChange in class javax.swing.JComponentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, long oldValue, long newValue)
firePropertyChange in class java.awt.Componentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, float oldValue, float newValue)
firePropertyChange in class java.awt.Componentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, double oldValue, double newValue)
firePropertyChange in class java.awt.Componentname - the property name.oldValue - the old value.newValue - the new value.public void firePropertyChange(java.lang.String name, boolean oldValue, boolean newValue)
firePropertyChange in class javax.swing.JComponentname - the property name.oldValue - the old value.newValue - the new value.