Class FlatComboBoxUI.CellPaddingBorder

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

    private static class FlatComboBoxUI.CellPaddingBorder
    extends javax.swing.border.AbstractBorder
    Cell padding border used in popup list and for current value if not editable.

    The insets are the union of the cell padding and the renderer border insets, which vertically aligns text in popup list with text in combobox.

    The renderer border is painted on the outer side of this border.

    For button style "mac", also used to increase insets on left side for "checked item" icon and to paint "checked item" icon for selected combobox item.

    • Constructor Summary

      Constructors 
      Constructor Description
      CellPaddingBorder​(java.awt.Insets padding)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Insets getBorderInsets​(java.awt.Component c, java.awt.Insets insets)  
      (package private) void install​(java.awt.Component c, int focusWidth)  
      void paintBorder​(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)  
      (package private) void uninstall()
      Uninstall border from previously installed component.
      • Methods inherited from class javax.swing.border.AbstractBorder

        getBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle, isBorderOpaque
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • padding

        private java.awt.Insets padding
      • rendererComponent

        private javax.swing.JComponent rendererComponent
      • rendererBorder

        private javax.swing.border.Border rendererBorder
      • focusWidth

        private int focusWidth
    • Constructor Detail

      • CellPaddingBorder

        CellPaddingBorder​(java.awt.Insets padding)
    • Method Detail

      • install

        void install​(java.awt.Component c,
                     int focusWidth)
      • uninstall

        void uninstall()
        Uninstall border from previously installed component. Because this border is installed in PopupListCellRenderer.getListCellRendererComponent(), there is no single place to uninstall it. This is the reason why this method is called from various places.
      • getBorderInsets

        public java.awt.Insets getBorderInsets​(java.awt.Component c,
                                               java.awt.Insets insets)
        Overrides:
        getBorderInsets in class javax.swing.border.AbstractBorder
      • 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 javax.swing.border.AbstractBorder