Package com.formdev.flatlaf.ui
Class FlatTreeUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TreeUI
-
- javax.swing.plaf.basic.BasicTreeUI
-
- com.formdev.flatlaf.ui.FlatTreeUI
-
- All Implemented Interfaces:
FlatStylingSupport.StyleableUI
public class FlatTreeUI extends BasicTreeUI implements FlatStylingSupport.StyleableUI
Provides the Flat LaF UI delegate forJTree
.- UiDefault:
- Tree.font Font, Tree.background Color, Tree.foreground Color unused, Tree.hash Color, Tree.dropLineColor Color, Tree.expandedIcon Icon, Tree.collapsedIcon Icon, Tree.leftChildIndent int, Tree.rightChildIndent int, Tree.rowHeight int, Tree.scrollsOnExpand boolean, Tree.scrollsHorizontallyAndVertically boolean, Tree.paintLines boolean, Tree.lineTypeDashed boolean, Tree.showsRootHandles boolean, Tree.repaintWholeRow boolean , Tree.leafIcon Icon, Tree.closedIcon Icon, Tree.openIcon Icon, Tree.textBackground Color, Tree.textForeground Color, Tree.selectionBackground Color, Tree.selectionForeground Color, Tree.selectionBorderColor Color focus indicator border color, Tree.drawsFocusBorderAroundIcon boolean, Tree.drawDashedFocusIndicator boolean, Tree.rendererFillBackground boolean default is true, Tree.rendererMargins Insets, Tree.dropCellBackground Color, Tree.dropCellForeground Color , Tree.editorBorder Border, Tree.editorBorderSelectionColor Color , Tree.border Border, Tree.selectionBackground Color, Tree.selectionForeground Color, Tree.selectionInactiveBackground Color, Tree.selectionInactiveForeground Color, Tree.selectionInsets Insets, Tree.selectionArc int, Tree.wideSelection boolean, Tree.showCellFocusIndicator boolean, Tree.showDefaultIcons boolean , Component.arrowType String chevron (default) or triangle, Tree.icon.expandedColor Color , Component.arrowType String chevron (default) or triangle, Tree.icon.collapsedColor Color , Tree.icon.leafColor Color , Tree.icon.closedColor Color , Tree.icon.openColor Color
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTreeUI
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.TreeTraverseAction
-
-
Field Summary
Fields Modifier and Type Field Description String
iconArrowType
Color
iconClosedColor
Color
iconCollapsedColor
Color
iconExpandedColor
Color
iconLeafColor
Color
iconOpenColor
protected boolean
paintSelection
protected int
selectionArc
protected Color
selectionBackground
protected Color
selectionBorderColor
protected Color
selectionForeground
protected Color
selectionInactiveBackground
protected Color
selectionInactiveForeground
protected Insets
selectionInsets
protected boolean
showCellFocusIndicator
protected boolean
showDefaultIcons
protected boolean
wideSelection
-
Fields inherited from class javax.swing.plaf.basic.BasicTreeUI
cellEditor, 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 Summary
Constructors Constructor Description FlatTreeUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyStyle(Object style)
protected Object
applyStyleProperty(String key, Object value)
protected MouseListener
createMouseListener()
protected PropertyChangeListener
createPropertyChangeListener()
protected TreeSelectionListener
createTreeSelectionListener()
static ComponentUI
createUI(JComponent c)
protected Rectangle
getDropLineRect(JTree.DropLocation loc)
Rectangle
getPathBounds(JTree tree, TreePath path)
Map<String,Class<?>>
getStyleableInfos(JComponent c)
Object
getStyleableValue(JComponent c, String key)
protected void
installDefaults()
protected void
installStyle()
void
installUI(JComponent c)
protected boolean
isPaintSelection()
protected boolean
isWideSelection()
void
paint(Graphics g, JComponent c)
protected void
paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
protected void
paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
Similar to super.paintRow(), but supports wide selection and uses inactive selection background/foreground if tree is not focused.protected void
paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
protected void
uninstallDefaults()
protected void
updateRenderer()
-
Methods inherited from class javax.swing.plaf.basic.BasicTreeUI
cancelEditing, checkForClickInExpandControl, completeEditing, completeEditing, completeUIInstall, completeUIUninstall, configureLayoutCache, createCellEditorListener, createCellRendererPane, createComponentListener, createDefaultCellEditor, createDefaultCellRenderer, createFocusListener, createKeyListener, createLayoutCache, createNodeDimensions, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getEditingPath, getExpandedIcon, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeadSelectionRow, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installKeyboardActions, installListeners, isDropLine, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paintDropLine, paintExpandControl, paintHorizontalPartOfLeg, paintVerticalPartOfLeg, pathWasCollapsed, pathWasExpanded, prepareForUIInstall, prepareForUIUninstall, selectPathForEvent, setCellEditor, setCellRenderer, setCollapsedIcon, setEditable, setExpandedIcon, setHashColor, setLargeModel, setLeftChildIndent, setModel, setPreferredMinSize, setRightChildIndent, setRootVisible, setRowHeight, setSelectionModel, setShowsRootHandles, shouldPaintExpandControl, startEditing, startEditingAtPath, stopEditing, toggleExpandState, uninstallComponents, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateLeadSelectionRow, updateSize
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
-
-
-
-
Field Detail
-
selectionBackground
protected Color selectionBackground
-
selectionForeground
protected Color selectionForeground
-
selectionInactiveBackground
protected Color selectionInactiveBackground
-
selectionInactiveForeground
protected Color selectionInactiveForeground
-
selectionBorderColor
protected Color selectionBorderColor
-
selectionInsets
protected Insets selectionInsets
- Since:
- 3
-
selectionArc
protected int selectionArc
- Since:
- 3
-
wideSelection
protected boolean wideSelection
-
showCellFocusIndicator
protected boolean showCellFocusIndicator
-
showDefaultIcons
protected boolean showDefaultIcons
- Since:
- 3
-
iconArrowType
public String iconArrowType
- Since:
- 2
-
iconExpandedColor
public Color iconExpandedColor
- Since:
- 2
-
iconCollapsedColor
public Color iconCollapsedColor
- Since:
- 2
-
iconLeafColor
public Color iconLeafColor
- Since:
- 2
-
iconClosedColor
public Color iconClosedColor
- Since:
- 2
-
iconOpenColor
public Color iconOpenColor
- Since:
- 2
-
paintSelection
protected boolean paintSelection
- Since:
- 2
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent c)
-
installUI
public void installUI(JComponent c)
- Overrides:
installUI
in classBasicTreeUI
-
installDefaults
protected void installDefaults()
- Overrides:
installDefaults
in classBasicTreeUI
-
uninstallDefaults
protected void uninstallDefaults()
- Overrides:
uninstallDefaults
in classBasicTreeUI
-
updateRenderer
protected void updateRenderer()
- Overrides:
updateRenderer
in classBasicTreeUI
-
createMouseListener
protected MouseListener createMouseListener()
- Overrides:
createMouseListener
in classBasicTreeUI
-
createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener()
- Overrides:
createPropertyChangeListener
in classBasicTreeUI
-
createTreeSelectionListener
protected TreeSelectionListener createTreeSelectionListener()
- Overrides:
createTreeSelectionListener
in classBasicTreeUI
-
getPathBounds
public Rectangle getPathBounds(JTree tree, TreePath path)
- Overrides:
getPathBounds
in classBasicTreeUI
-
installStyle
protected void installStyle()
- Since:
- 2
-
applyStyle
protected void applyStyle(Object style)
- Since:
- 2
-
getStyleableInfos
public Map<String,Class<?>> getStyleableInfos(JComponent c)
- Specified by:
getStyleableInfos
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2
-
getStyleableValue
public Object getStyleableValue(JComponent c, String key)
- Specified by:
getStyleableValue
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2.5
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paint
in classBasicTreeUI
-
paintRow
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
Similar to super.paintRow(), but supports wide selection and uses inactive selection background/foreground if tree is not focused.- Overrides:
paintRow
in classBasicTreeUI
-
paintVerticalLine
protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
- Overrides:
paintVerticalLine
in classBasicTreeUI
-
paintHorizontalLine
protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
- Overrides:
paintHorizontalLine
in classBasicTreeUI
-
getDropLineRect
protected Rectangle getDropLineRect(JTree.DropLocation loc)
- Overrides:
getDropLineRect
in classBasicTreeUI
-
isWideSelection
protected boolean isWideSelection()
-
isPaintSelection
protected boolean isPaintSelection()
-
-