public class SourceListTreeUI extends BasicTreeUI
A UI delegate that paints a JTree as an Apple defined
Source List. Consider using this UI delegate with
MacWidgetFactory.createSourceListScrollPane(javax.swing.JComponent).
For the best development experience, it is recommended that you migrate your code to use the
SourceList with the SourceListModel, as this component abstracts away many of the
complexities of JTree.
Pictured below are the two different rendering styles of a Source List: focused and unfocused.
The corresponding JTree's focusable property drives this rendering style.
![]() |
![]() |
| Focusable SourceList | Non-focusable SourceList |
DefaultMutableTreeNode, and the
DefaultMutableTreeNode.getUserObject() is an instance of TextProvider, then
the TextProvider will be queried for the node text.TextProvider is found, the standard
JTree.convertValueToText(Object, boolean, boolean, boolean, int, boolean) method will
be consulted.DefaultMutableTreeNode, and the
DefaultMutableTreeNode.getUserObject() is an instance of IconProvider, then
the IconProvider will be queried for the node icon.BasicTreeUI.CellEditorHandler, BasicTreeUI.ComponentHandler, BasicTreeUI.FocusHandler, BasicTreeUI.KeyHandler, BasicTreeUI.MouseHandler, BasicTreeUI.MouseInputHandler, BasicTreeUI.NodeDimensionsHandler, BasicTreeUI.PropertyChangeHandler, BasicTreeUI.SelectionModelPropertyChangeHandler, BasicTreeUI.TreeCancelEditingAction, BasicTreeUI.TreeExpansionHandler, BasicTreeUI.TreeHomeAction, BasicTreeUI.TreeIncrementAction, BasicTreeUI.TreeModelHandler, BasicTreeUI.TreePageAction, BasicTreeUI.TreeSelectionHandler, BasicTreeUI.TreeToggleAction, BasicTreeUI.TreeTraverseActioncellEditor, collapsedIcon, createdCellEditor, createdRenderer, currentCellRenderer, depthOffset, drawingCache, editingComponent, editingPath, editingRow, editorHasDifferentSize, expandedIcon, largeModel, lastSelectedRow, leftChildIndent, nodeDimensions, preferredMinSize, preferredSize, rendererPane, rightChildIndent, stopEditingInCompleteEditing, totalChildIndent, tree, treeModel, treeSelectionModel, treeState, validCachedPreferredSize| Constructor and Description |
|---|
SourceListTreeUI() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
completeUIInstall() |
protected AbstractLayoutCache.NodeDimensions |
createNodeDimensions() |
SourceListColorScheme |
getColorScheme()
Gets the
SourceListColorScheme that this SourceListTreeUI uses to paint. |
Rectangle |
getPathBounds(JTree tree,
TreePath path) |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
paint(Graphics g,
JComponent c) |
protected void |
paintExpandControl(Graphics g,
Rectangle clipBounds,
Insets insets,
Rectangle bounds,
TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf) |
protected void |
paintHorizontalLine(Graphics g,
JComponent c,
int y,
int left,
int right) |
protected void |
paintVerticalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
TreePath path) |
protected void |
selectPathForEvent(TreePath path,
MouseEvent event) |
void |
setColorScheme(SourceListColorScheme colorScheme)
Sets the
SourceListColorScheme that this SourceListTreeUI uses to paint. |
protected void |
setModel(TreeModel model) |
cancelEditing, checkForClickInExpandControl, completeEditing, completeEditing, completeUIUninstall, configureLayoutCache, createCellEditorListener, createCellRendererPane, createComponentListener, createDefaultCellEditor, createDefaultCellRenderer, createFocusListener, createKeyListener, createLayoutCache, createMouseListener, createPropertyChangeListener, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, createTreeSelectionListener, createUI, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getDropLineRect, getEditingPath, getExpandedIcon, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeadSelectionRow, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installDefaults, installUI, isDropLine, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paintDropLine, paintHorizontalPartOfLeg, paintRow, paintVerticalLine, pathWasCollapsed, pathWasExpanded, prepareForUIInstall, prepareForUIUninstall, setCellEditor, setCellRenderer, setCollapsedIcon, setEditable, setExpandedIcon, setHashColor, setLargeModel, setLeftChildIndent, setPreferredMinSize, setRightChildIndent, setRootVisible, setRowHeight, setSelectionModel, setShowsRootHandles, shouldPaintExpandControl, startEditing, startEditingAtPath, stopEditing, toggleExpandState, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateLeadSelectionRow, updateRenderer, updateSizecontains, getAccessibleChild, getAccessibleChildrenCount, updateprotected void completeUIInstall()
completeUIInstall in class BasicTreeUIprotected void installListeners()
installListeners in class BasicTreeUIprotected void installKeyboardActions()
installKeyboardActions in class BasicTreeUIprotected void setModel(TreeModel model)
setModel in class BasicTreeUIpublic SourceListColorScheme getColorScheme()
SourceListColorScheme that this SourceListTreeUI uses to paint.SourceListColorScheme that this SourceList uses to paint.public void setColorScheme(SourceListColorScheme colorScheme)
SourceListColorScheme that this SourceListTreeUI uses to paint.colorScheme - the SourceListColorScheme that this SourceList uses to
paint.protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
paintExpandControl in class BasicTreeUIprotected AbstractLayoutCache.NodeDimensions createNodeDimensions()
createNodeDimensions in class BasicTreeUIpublic Rectangle getPathBounds(JTree tree, TreePath path)
getPathBounds in class BasicTreeUIpublic void paint(Graphics g, JComponent c)
paint in class BasicTreeUIprotected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
paintHorizontalLine in class BasicTreeUIprotected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
paintVerticalPartOfLeg in class BasicTreeUIprotected void selectPathForEvent(TreePath path, MouseEvent event)
selectPathForEvent in class BasicTreeUI