Class FlatTableUI

All Implemented Interfaces:
FlatStylingSupport.StyleableUI, FlatViewportUI.ViewportPainter

Provides the Flat LaF UI delegate for JTable.
  • Field Details

    • showHorizontalLines

      protected boolean showHorizontalLines
    • showVerticalLines

      protected boolean showVerticalLines
    • showTrailingVerticalLine

      protected boolean showTrailingVerticalLine
      Since:
      1.6
    • intercellSpacing

      protected Dimension intercellSpacing
    • selectionBackground

      protected Color selectionBackground
    • selectionForeground

      protected Color selectionForeground
    • selectionInactiveBackground

      protected Color selectionInactiveBackground
    • selectionInactiveForeground

      protected Color selectionInactiveForeground
    • selectionInsets

      protected Insets selectionInsets
      Since:
      3.5
    • selectionArc

      protected int selectionArc
      Since:
      3.5
    • cellMargins

      protected Insets cellMargins
      Since:
      2
    • cellFocusColor

      protected Color cellFocusColor
      Since:
      2
    • showCellFocusIndicator

      protected Boolean showCellFocusIndicator
      Since:
      2
    • oldShowHorizontalLines

      private boolean oldShowHorizontalLines
    • oldShowVerticalLines

      private boolean oldShowVerticalLines
    • oldIntercellSpacing

      private Dimension oldIntercellSpacing
    • oldBooleanRenderer

      private TableCellRenderer oldBooleanRenderer
    • propertyChangeListener

      private PropertyChangeListener propertyChangeListener
    • outsideAlternateRowsListener

      private ComponentListener outsideAlternateRowsListener
    • rowSelectionListener

      private ListSelectionListener rowSelectionListener
    • columnSelectionListener

      private TableColumnModelListener columnSelectionListener
    • oldStyleValues

      private Map<String,Object> oldStyleValues
  • Constructor Details

    • FlatTableUI

      public FlatTableUI()
  • Method Details

    • createUI

      public static ComponentUI createUI(JComponent c)
    • installUI

      public void installUI(JComponent c)
      Overrides:
      installUI in class BasicTableUI
    • installDefaults

      protected void installDefaults()
      Overrides:
      installDefaults in class BasicTableUI
    • uninstallDefaults

      protected void uninstallDefaults()
      Overrides:
      uninstallDefaults in class BasicTableUI
    • installListeners

      protected void installListeners()
      Overrides:
      installListeners in class BasicTableUI
    • uninstallListeners

      protected void uninstallListeners()
      Overrides:
      uninstallListeners in class BasicTableUI
    • createFocusListener

      protected FocusListener createFocusListener()
      Overrides:
      createFocusListener in class BasicTableUI
    • installKeyboardActions

      protected void installKeyboardActions()
      Overrides:
      installKeyboardActions in class BasicTableUI
    • installStyle

      protected void installStyle()
      Since:
      2
    • applyStyle

      protected void applyStyle(Object style)
      Since:
      2
    • applyStyleProperty

      protected Object applyStyleProperty(String key, Object value)
      Since:
      2
    • getStyleableInfos

      public Map<String,Class<?>> getStyleableInfos(JComponent c)
      Specified by:
      getStyleableInfos in interface FlatStylingSupport.StyleableUI
      Since:
      2
    • getStyleableValue

      public Object getStyleableValue(JComponent c, String key)
      Specified by:
      getStyleableValue in interface FlatStylingSupport.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

      public void paint(Graphics g, JComponent c)
      Overrides:
      paint in class BasicTableUI
    • hideLastVerticalLine

      protected boolean hideLastVerticalLine()
    • paintViewport

      public void paintViewport(Graphics g, JComponent c, JViewport viewport)
      Specified by:
      paintViewport in interface FlatViewportUI.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. Supports selectionArc and selectionInsets.

      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. Supports selectionArc and selectionInsets.

      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 selectionArc and selectionInsets.

      Since:
      3.5
    • installRepaintRoundedSelectionListeners

      private void installRepaintRoundedSelectionListeners()
    • repaintRoundedRowSelection

      private void repaintRoundedRowSelection(ListSelectionEvent e)
    • repaintRoundedColumnSelection

      private void repaintRoundedColumnSelection(ListSelectionEvent e)