Class FlatTableUI.RoundedSelectionGraphics

java.lang.Object
java.awt.Graphics
java.awt.Graphics2D
com.formdev.flatlaf.util.Graphics2DProxy
com.formdev.flatlaf.ui.FlatTableUI.RoundedSelectionGraphics
Enclosing class:
FlatTableUI

private class FlatTableUI.RoundedSelectionGraphics extends Graphics2DProxy
Because selection painting is done in the cell renderer, it would be necessary to require a FlatLaf specific renderer to implement rounded selection. Using a LaF specific renderer was avoided because often a custom renderer is already used in applications. Then either the rounded selection is not used, or the application has to be changed to extend a FlatLaf renderer.

To solve this, a graphics proxy is used that paints rounded selection if row/column/cell is selected and the renderer wants to fill the background.

  • Field Details

    • alternateRowColor

      private final Color alternateRowColor
    • inPaintSelection

      private boolean inPaintSelection
  • Constructor Details

    • RoundedSelectionGraphics

      RoundedSelectionGraphics(Graphics delegate, Color alternateRowColor)
  • Method Details

    • create

      public Graphics create()
      Overrides:
      create in class Graphics2DProxy
    • create

      public Graphics create(int x, int y, int width, int height)
      Overrides:
      create in class Graphics2DProxy
    • fillRect

      public void fillRect(int x, int y, int width, int height)
      Overrides:
      fillRect in class Graphics2DProxy
    • fill

      public void fill(Shape shape)
      Overrides:
      fill in class Graphics2DProxy
    • fillCellSelection

      private boolean fillCellSelection(int x, int y, int width, int height)
    • findActiveRendererComponent

      private Component findActiveRendererComponent()
      A CellRendererPane may contain multiple components, if multiple renderers are used. Inactive renderer components have size 0x0.