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 StringiconArrowTypeColoriconClosedColorColoriconCollapsedColorColoriconExpandedColorColoriconLeafColorColoriconOpenColorprotected booleanpaintSelectionprotected intselectionArcprotected ColorselectionBackgroundprotected ColorselectionBorderColorprotected ColorselectionForegroundprotected ColorselectionInactiveBackgroundprotected ColorselectionInactiveForegroundprotected InsetsselectionInsetsprotected booleanshowCellFocusIndicatorprotected booleanshowDefaultIconsprotected booleanwideSelection-
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 voidapplyStyle(Object style)protected ObjectapplyStyleProperty(String key, Object value)protected MouseListenercreateMouseListener()protected PropertyChangeListenercreatePropertyChangeListener()protected TreeSelectionListenercreateTreeSelectionListener()static ComponentUIcreateUI(JComponent c)protected RectanglegetDropLineRect(JTree.DropLocation loc)RectanglegetPathBounds(JTree tree, TreePath path)Map<String,Class<?>>getStyleableInfos(JComponent c)ObjectgetStyleableValue(JComponent c, String key)protected voidinstallDefaults()protected voidinstallStyle()voidinstallUI(JComponent c)protected booleanisPaintSelection()protected booleanisWideSelection()voidpaint(Graphics g, JComponent c)protected voidpaintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)protected voidpaintRow(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 voidpaintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)protected voiduninstallDefaults()protected voidupdateRenderer()-
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:
installUIin classBasicTreeUI
-
installDefaults
protected void installDefaults()
- Overrides:
installDefaultsin classBasicTreeUI
-
uninstallDefaults
protected void uninstallDefaults()
- Overrides:
uninstallDefaultsin classBasicTreeUI
-
updateRenderer
protected void updateRenderer()
- Overrides:
updateRendererin classBasicTreeUI
-
createMouseListener
protected MouseListener createMouseListener()
- Overrides:
createMouseListenerin classBasicTreeUI
-
createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener()
- Overrides:
createPropertyChangeListenerin classBasicTreeUI
-
createTreeSelectionListener
protected TreeSelectionListener createTreeSelectionListener()
- Overrides:
createTreeSelectionListenerin classBasicTreeUI
-
getPathBounds
public Rectangle getPathBounds(JTree tree, TreePath path)
- Overrides:
getPathBoundsin 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:
getStyleableInfosin interfaceFlatStylingSupport.StyleableUI- Since:
- 2
-
getStyleableValue
public Object getStyleableValue(JComponent c, String key)
- Specified by:
getStyleableValuein interfaceFlatStylingSupport.StyleableUI- Since:
- 2.5
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paintin 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:
paintRowin classBasicTreeUI
-
paintVerticalLine
protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
- Overrides:
paintVerticalLinein classBasicTreeUI
-
paintHorizontalLine
protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
- Overrides:
paintHorizontalLinein classBasicTreeUI
-
getDropLineRect
protected Rectangle getDropLineRect(JTree.DropLocation loc)
- Overrides:
getDropLineRectin classBasicTreeUI
-
isWideSelection
protected boolean isWideSelection()
-
isPaintSelection
protected boolean isPaintSelection()
-
-