Class FlatBorder

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.border.Border, javax.swing.plaf.UIResource
    Direct Known Subclasses:
    FlatButtonBorder, FlatRoundBorder, FlatTextBorder

    public class FlatBorder
    extends javax.swing.plaf.basic.BasicBorders.MarginBorder
    Border for various components (e.g. JTextField). There is empty space around the component border, if Component.focusWidth is greater than zero, which is used to paint outer focus border. Because there is empty space (if outer focus border is not painted), UI delegates that use this border (or subclasses) must invoke FlatUIUtils.paintParentBackground(java.awt.Graphics, javax.swing.JComponent) to paint the empty space correctly.
    See Also:
    Serialized Form
    UiDefault:
    Component.focusWidth int, Component.innerFocusWidth int or float, Component.focusColor Color, Component.borderColor Color, Component.disabledBorderColor Color, Component.focusedBorderColor Color, Component.error.borderColor Color, Component.error.focusedBorderColor Color, Component.warning.borderColor Color, Component.warning.focusedBorderColor Color, Component.custom.borderColor Color
    • Constructor Summary

      Constructors 
      Constructor Description
      FlatBorder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int getArc​(java.awt.Component c)
      Returns the (unscaled) arc diameter of the border.
      protected java.awt.Paint getBorderColor​(java.awt.Component c)  
      java.awt.Insets getBorderInsets​(java.awt.Component c, java.awt.Insets insets)  
      protected int getBorderWidth​(java.awt.Component c)
      Returns the (unscaled) line thickness used to paint the border.
      protected java.awt.Color getFocusColor​(java.awt.Component c)  
      protected int getFocusWidth​(java.awt.Component c)
      Returns the (unscaled) thickness of the outer focus border.
      protected int getLineWidth​(java.awt.Component c)
      Returns the (unscaled) line thickness used to compute the border insets.
      protected java.awt.Color getOutlineColor​(java.awt.Component c)
      Returns the outline color of the component border specified in client property FlatClientProperties.OUTLINE.
      protected boolean isCellEditor​(java.awt.Component c)  
      protected boolean isEnabled​(java.awt.Component c)  
      protected boolean isFocused​(java.awt.Component c)  
      void paintBorder​(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)  
      • 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

      • focusWidth

        protected final int focusWidth
      • innerFocusWidth

        protected final float innerFocusWidth
      • innerOutlineWidth

        protected final float innerOutlineWidth
      • focusColor

        protected final java.awt.Color focusColor
      • borderColor

        protected final java.awt.Color borderColor
      • disabledBorderColor

        protected final java.awt.Color disabledBorderColor
      • focusedBorderColor

        protected final java.awt.Color focusedBorderColor
      • errorBorderColor

        protected final java.awt.Color errorBorderColor
      • errorFocusedBorderColor

        protected final java.awt.Color errorFocusedBorderColor
      • warningBorderColor

        protected final java.awt.Color warningBorderColor
      • warningFocusedBorderColor

        protected final java.awt.Color warningFocusedBorderColor
      • customBorderColor

        protected final java.awt.Color customBorderColor
    • Constructor Detail

      • FlatBorder

        public FlatBorder()
    • 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 javax.swing.border.AbstractBorder
      • getOutlineColor

        protected java.awt.Color getOutlineColor​(java.awt.Component c)
        Returns the outline color of the component border specified in client property FlatClientProperties.OUTLINE.
      • getFocusColor

        protected java.awt.Color getFocusColor​(java.awt.Component c)
      • getBorderColor

        protected java.awt.Paint getBorderColor​(java.awt.Component c)
      • isEnabled

        protected boolean isEnabled​(java.awt.Component c)
      • isFocused

        protected boolean isFocused​(java.awt.Component c)
      • isCellEditor

        protected boolean isCellEditor​(java.awt.Component c)
      • getBorderInsets

        public java.awt.Insets getBorderInsets​(java.awt.Component c,
                                               java.awt.Insets insets)
        Overrides:
        getBorderInsets in class javax.swing.plaf.basic.BasicBorders.MarginBorder
      • getFocusWidth

        protected int getFocusWidth​(java.awt.Component c)
        Returns the (unscaled) thickness of the outer focus border.
      • getLineWidth

        protected int getLineWidth​(java.awt.Component c)
        Returns the (unscaled) line thickness used to compute the border insets. This may be different to getBorderWidth(java.awt.Component).
      • getBorderWidth

        protected int getBorderWidth​(java.awt.Component c)
        Returns the (unscaled) line thickness used to paint the border. This may be different to getLineWidth(java.awt.Component).
      • getArc

        protected int getArc​(java.awt.Component c)
        Returns the (unscaled) arc diameter of the border.