Class 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 Detail

      • alternateRowColor

        private final java.awt.Color alternateRowColor
      • inPaintSelection

        private boolean inPaintSelection
    • Constructor Detail

      • RoundedSelectionGraphics

        RoundedSelectionGraphics​(java.awt.Graphics delegate,
                                 java.awt.Color alternateRowColor)
    • Method Detail

      • create

        public java.awt.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
      • fillCellSelection

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

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