Package com.formdev.flatlaf.ui
Class FlatBorder
- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- javax.swing.plaf.basic.BasicBorders.MarginBorder
-
- com.formdev.flatlaf.ui.FlatBorder
-
- All Implemented Interfaces:
Serializable,Border,UIResource
- Direct Known Subclasses:
FlatButtonBorder,FlatRoundBorder,FlatTextBorder
public class FlatBorder extends 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 invokeFlatUIUtils.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.innerOutlineWidth 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
-
-
Field Summary
Fields Modifier and Type Field Description protected ColorborderColorprotected ColorcustomBorderColorprotected ColordisabledBorderColorprotected ColorerrorBorderColorprotected ColorerrorFocusedBorderColorprotected ColorfocusColorprotected ColorfocusedBorderColorprotected intfocusWidthprotected floatinnerFocusWidthprotected floatinnerOutlineWidthprotected ColorwarningBorderColorprotected ColorwarningFocusedBorderColor
-
Constructor Summary
Constructors Constructor Description FlatBorder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intgetArc(Component c)Returns the (unscaled) arc diameter of the border.protected PaintgetBorderColor(Component c)InsetsgetBorderInsets(Component c, Insets insets)protected intgetBorderWidth(Component c)Returns the (unscaled) line thickness used to paint the border.protected ColorgetFocusColor(Component c)protected intgetFocusWidth(Component c)Returns the (unscaled) thickness of the outer focus border.protected floatgetInnerFocusWidth(Component c)Returns the (unscaled) thickness of the inner focus border.protected intgetLineWidth(Component c)Returns the (unscaled) line thickness used to compute the border insets.protected ColorgetOutlineColor(Component c)Returns the outline color of the component border specified in client propertyFlatClientProperties.OUTLINE.protected booleanisCellEditor(Component c)protected booleanisEnabled(Component c)protected booleanisFocused(Component c)voidpaintBorder(Component c, Graphics g, int x, int y, int width, int height)-
Methods inherited from class javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle, isBorderOpaque
-
-
-
-
Field Detail
-
focusWidth
protected final int focusWidth
-
innerFocusWidth
protected final float innerFocusWidth
-
innerOutlineWidth
protected final float innerOutlineWidth
-
focusColor
protected final Color focusColor
-
borderColor
protected final Color borderColor
-
disabledBorderColor
protected final Color disabledBorderColor
-
focusedBorderColor
protected final Color focusedBorderColor
-
errorBorderColor
protected final Color errorBorderColor
-
errorFocusedBorderColor
protected final Color errorFocusedBorderColor
-
warningBorderColor
protected final Color warningBorderColor
-
warningFocusedBorderColor
protected final Color warningFocusedBorderColor
-
customBorderColor
protected final Color customBorderColor
-
-
Method Detail
-
paintBorder
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
- Specified by:
paintBorderin interfaceBorder- Overrides:
paintBorderin classAbstractBorder
-
getOutlineColor
protected Color getOutlineColor(Component c)
Returns the outline color of the component border specified in client propertyFlatClientProperties.OUTLINE.
-
isEnabled
protected boolean isEnabled(Component c)
-
isFocused
protected boolean isFocused(Component c)
-
isCellEditor
protected boolean isCellEditor(Component c)
-
getBorderInsets
public Insets getBorderInsets(Component c, Insets insets)
- Overrides:
getBorderInsetsin classBasicBorders.MarginBorder
-
getFocusWidth
protected int getFocusWidth(Component c)
Returns the (unscaled) thickness of the outer focus border.
-
getInnerFocusWidth
protected float getInnerFocusWidth(Component c)
Returns the (unscaled) thickness of the inner focus border.
-
getLineWidth
protected int getLineWidth(Component c)
Returns the (unscaled) line thickness used to compute the border insets. This may be different togetBorderWidth(java.awt.Component).
-
getBorderWidth
protected int getBorderWidth(Component c)
Returns the (unscaled) line thickness used to paint the border. This may be different togetLineWidth(java.awt.Component).
-
getArc
protected int getArc(Component c)
Returns the (unscaled) arc diameter of the border.
-
-