Class FlatListUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ListUI
javax.swing.plaf.basic.BasicListUI
com.formdev.flatlaf.ui.FlatListUI
- All Implemented Interfaces:
FlatStylingSupport.StyleableUI
Provides the Flat LaF UI delegate for
JList.
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicListUI
BasicListUI.FocusHandler, BasicListUI.ListDataHandler, BasicListUI.ListSelectionHandler, BasicListUI.MouseInputHandler, BasicListUI.PropertyChangeHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Colorprotected Colorprotected Insetsprotected intprotected Colorprotected Colorprotected Colorprotected Colorprotected Insetsprotected BooleanFields inherited from class BasicListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyStyle(Object style) protected ObjectapplyStyleProperty(String key, Object value) protected FocusListenerprotected ListSelectionListenerprotected PropertyChangeListenerstatic ComponentUIgetStyleableValue(JComponent c, String key) protected voidprotected voidvoidprivate voidprotected voidpaintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer cellRenderer, ListModel dataModel, ListSelectionModel selModel, int leadIndex) protected voidpaintCellSelection(Graphics g, int row, int x, int y, int width, int height) Paints (rounded) cell selection.static voidpaintCellSelection(JList<?> list, Graphics g, int row, int x, int y, int width, int height) Paints a cell selection at the given coordinates.private voidToggle selection colors from focused to inactive and vice versa.protected voidprivate booleanuseUnitedRoundedSelection(boolean vertical, boolean horizontal) Methods inherited from class BasicListUI
convertRowToY, convertYToRow, createListDataListener, createMouseInputListener, getBaseline, getBaselineResizeBehavior, getCellBounds, getPreferredSize, getRowHeight, indexToLocation, installKeyboardActions, installListeners, locationToIndex, maybeUpdateLayoutState, paint, selectNextIndex, selectPreviousIndex, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateLayoutStateMethods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, update
-
Field Details
-
selectionBackground
-
selectionForeground
-
selectionInactiveBackground
-
selectionInactiveForeground
-
alternateRowColor
- Since:
- 3.6
-
selectionInsets
- Since:
- 3
-
selectionArc
protected int selectionArc- Since:
- 3
-
cellMargins
- Since:
- 2
-
cellFocusColor
- Since:
- 2
-
showCellFocusIndicator
- Since:
- 2
-
oldStyleValues
-
-
Constructor Details
-
FlatListUI
public FlatListUI()
-
-
Method Details
-
createUI
-
installUI
- Overrides:
installUIin classBasicListUI
-
installUIImpl
-
installDefaults
protected void installDefaults()- Overrides:
installDefaultsin classBasicListUI
-
uninstallDefaults
protected void uninstallDefaults()- Overrides:
uninstallDefaultsin classBasicListUI
-
createFocusListener
- Overrides:
createFocusListenerin classBasicListUI
-
createPropertyChangeListener
- Overrides:
createPropertyChangeListenerin classBasicListUI
-
createListSelectionListener
- Overrides:
createListSelectionListenerin classBasicListUI
-
installStyle
protected void installStyle()- Since:
- 2
-
applyStyle
- Since:
- 2
-
applyStyleProperty
-
getStyleableInfos
- Specified by:
getStyleableInfosin interfaceFlatStylingSupport.StyleableUI- Since:
- 2
-
getStyleableValue
- Specified by:
getStyleableValuein interfaceFlatStylingSupport.StyleableUI- Since:
- 2.5
-
toggleSelectionColors
private void toggleSelectionColors()Toggle selection colors from focused to inactive and vice versa. This is not an optimal solution but much easier than rewriting the whole paint methods. Using a LaF specific renderer was avoided because often a custom renderer is already used in applications. Then either the inactive colors are not used, or the application has to be changed to extend a FlatLaf renderer. -
paintCell
protected void paintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer cellRenderer, ListModel dataModel, ListSelectionModel selModel, int leadIndex) - Overrides:
paintCellin classBasicListUI
-
paintCellSelection
Paints (rounded) cell selection. SupportsselectionArcandselectionInsets.Note: This method is only invoked if either selection arc is greater than zero or if selection insets are not empty.
- Since:
- 3
-
useUnitedRoundedSelection
private boolean useUnitedRoundedSelection(boolean vertical, boolean horizontal) -
paintCellSelection
public static void paintCellSelection(JList<?> list, Graphics g, int row, int x, int y, int width, int height) Paints a cell selection at the given coordinates. The selection color must be set on the graphics context.This method is intended for use in custom cell renderers to support
selectionArcandselectionInsets.- Since:
- 3
-