Class FlatTableCellBorder.Selected

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.border.Border, javax.swing.plaf.UIResource
    Enclosing class:
    FlatTableCellBorder

    public static class FlatTableCellBorder.Selected
    extends FlatTableCellBorder
    Border for selected cell that uses margins and paints focus indicator border. The focus indicator is shown under following conditions:
    • always if enabled via UI property Table.showCellFocusIndicator=true
    • for row selection mode if exactly one row is selected and at least one cell in that row is editable
    • for column selection mode if exactly one column is selected and at least one cell in that column is editable
    • never for cell selection mode
    The reason for this logic is to hide the focus indicator when it is not needed, and only show it when there are editable cells and the user needs to know which cell is focused to start editing.

    To avoid possible performance issues, checking for editable cells is limited to maxCheckCellsEditable. If there are more cells to check, the focus indicator is always shown.

    See Also:
    Serialized Form
    • Field Detail

      • maxCheckCellsEditable

        public int maxCheckCellsEditable
        Since:
        3.1
    • Constructor Detail

      • Selected

        public Selected()
    • Method Detail

      • paintBorder

        public void paintBorder​(java.awt.Component c,
                                java.awt.Graphics g,
                                int x,
                                int y,
                                int width,
                                int height)
        Specified by:
        paintBorder in interface javax.swing.border.Border
        Overrides:
        paintBorder in class FlatTableCellBorder
      • shouldShowCellFocusIndicator

        protected boolean shouldShowCellFocusIndicator​(javax.swing.JTable table)
        Returns whether focus indicator border should be shown.
        Since:
        3.1