Class FlatTableUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TableUI
javax.swing.plaf.basic.BasicTableUI
com.formdev.flatlaf.ui.FlatTableUI
- All Implemented Interfaces:
FlatStylingSupport.StyleableUI, FlatViewportUI.ViewportPainter
public class FlatTableUI
extends BasicTableUI
implements FlatStylingSupport.StyleableUI, FlatViewportUI.ViewportPainter
Provides the Flat LaF UI delegate for
JTable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate classUsed if table auto-resize-mode is off to repaint outside alternate rows when table width changed (column resized) or component orientation changed.private static classListener that watches for change of some table properties from application code.private classBecause selection painting is done in the cell renderer, it would be necessary to require a FlatLaf specific renderer to implement rounded selection.private static classNested classes/interfaces inherited from class BasicTableUI
BasicTableUI.FocusHandler, BasicTableUI.KeyHandler, BasicTableUI.MouseInputHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Colorprotected Insetsprivate TableColumnModelListenerprotected Dimensionprivate TableCellRendererprivate Dimensionprivate booleanprivate booleanprivate ComponentListenerprivate PropertyChangeListenerprivate ListSelectionListenerprotected intprotected Colorprotected Colorprotected Colorprotected Colorprotected Insetsprotected Booleanprotected booleanprotected booleanprotected booleanFields inherited from class BasicTableUI
focusListener, keyListener, mouseInputListener, rendererPane, table -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyStyle(Object style) protected ObjectapplyStyleProperty(String key, Object value) protected FocusListenerstatic ComponentUIgetStyleableValue(JComponent c, String key) protected booleanprotected voidprotected voidprotected voidprivate voidprotected voidvoidvoidpaint(Graphics g, JComponent c) protected voidpaintAlternateRowBackground(Graphics g, int row, int column, int x, int y, int width, int height) Paints (rounded) alternate row background.protected voidpaintCellSelection(Graphics g, int row, int column, int x, int y, int width, int height) Paints (rounded) cell selection.static voidpaintCellSelection(JTable table, Graphics g, int row, int column, int x, int y, int width, int height) Paints a cell selection at the given coordinates.voidpaintViewport(Graphics g, JComponent c, JViewport viewport) private voidprivate voidprivate voidToggle selection colors from focused to inactive and vice versa.protected voidprotected voidMethods inherited from class BasicTableUI
createKeyListener, createMouseInputListener, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, uninstallKeyboardActions, uninstallUIMethods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
-
Field Details
-
showHorizontalLines
protected boolean showHorizontalLines -
showVerticalLines
protected boolean showVerticalLines -
showTrailingVerticalLine
protected boolean showTrailingVerticalLine- Since:
- 1.6
-
intercellSpacing
-
selectionBackground
-
selectionForeground
-
selectionInactiveBackground
-
selectionInactiveForeground
-
selectionInsets
- Since:
- 3.5
-
selectionArc
protected int selectionArc- Since:
- 3.5
-
cellMargins
- Since:
- 2
-
cellFocusColor
- Since:
- 2
-
showCellFocusIndicator
- Since:
- 2
-
oldShowHorizontalLines
private boolean oldShowHorizontalLines -
oldShowVerticalLines
private boolean oldShowVerticalLines -
oldIntercellSpacing
-
oldBooleanRenderer
-
propertyChangeListener
-
outsideAlternateRowsListener
-
rowSelectionListener
-
columnSelectionListener
-
oldStyleValues
-
-
Constructor Details
-
FlatTableUI
public FlatTableUI()
-
-
Method Details
-
createUI
-
installUI
- Overrides:
installUIin classBasicTableUI
-
installDefaults
protected void installDefaults()- Overrides:
installDefaultsin classBasicTableUI
-
uninstallDefaults
protected void uninstallDefaults()- Overrides:
uninstallDefaultsin classBasicTableUI
-
installListeners
protected void installListeners()- Overrides:
installListenersin classBasicTableUI
-
uninstallListeners
protected void uninstallListeners()- Overrides:
uninstallListenersin classBasicTableUI
-
createFocusListener
- Overrides:
createFocusListenerin classBasicTableUI
-
installKeyboardActions
protected void installKeyboardActions()- Overrides:
installKeyboardActionsin classBasicTableUI
-
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. -
paint
- Overrides:
paintin classBasicTableUI
-
hideLastVerticalLine
protected boolean hideLastVerticalLine() -
paintViewport
- Specified by:
paintViewportin interfaceFlatViewportUI.ViewportPainter- Since:
- 2.3
-
paintAlternateRowBackground
protected void paintAlternateRowBackground(Graphics g, int row, int column, int x, int y, int width, int height) Paints (rounded) alternate row background. SupportsselectionArcandselectionInsets.Note: This method is only invoked if either selection arc is greater than zero or if selection insets are not empty.
- Since:
- 3.5
-
paintCellSelection
protected void paintCellSelection(Graphics g, int row, int column, int x, int y, int width, int height) 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.5
-
paintCellSelection
public static void paintCellSelection(JTable table, Graphics g, int row, int column, 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.5
-
installRepaintRoundedSelectionListeners
private void installRepaintRoundedSelectionListeners() -
repaintRoundedRowSelection
-
repaintRoundedColumnSelection
-