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:
FlatStylingSupport.StyleableBorder
,Serializable
,Border
,UIResource
- Direct Known Subclasses:
FlatButtonBorder
,FlatRoundBorder
,FlatTextBorder
public class FlatBorder extends BasicBorders.MarginBorder implements FlatStylingSupport.StyleableBorder
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 fill the empty space correctly.- See Also:
- Serialized Form
- UiDefault:
- Component.focusWidth int, Component.innerFocusWidth int or float, Component.innerOutlineWidth int or float, Component.borderWidth 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 Color
borderColor
protected float
borderWidth
protected Color
customBorderColor
protected Color
disabledBorderColor
protected Color
errorBorderColor
protected Color
errorFocusedBorderColor
protected Color
focusColor
protected Color
focusedBorderColor
protected int
focusWidth
protected float
innerFocusWidth
protected float
innerOutlineWidth
protected String
outline
protected Color
outlineColor
protected Color
outlineFocusedColor
protected Color
warningBorderColor
protected Color
warningFocusedBorderColor
-
Constructor Summary
Constructors Constructor Description FlatBorder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
applyStyleProperty(String key, Object value)
protected int
getArc(Component c)
Returns the (unscaled) arc diameter of the border.protected Paint
getBorderColor(Component c)
Insets
getBorderInsets(Component c, Insets insets)
protected float
getBorderWidth(Component c)
Returns the (unscaled) line thickness used to paint the border.protected Color
getFocusColor(Component c)
protected int
getFocusWidth(Component c)
Returns the (unscaled) thickness of the outer focus border.protected float
getInnerFocusWidth(Component c)
Returns the (unscaled) thickness of the inner focus border.protected int
getLineWidth(Component c)
Returns the (unscaled) line thickness used to compute the border insets.protected Color
getOutlineColor(Component c)
Returns the outline color of the component border specified in client propertyFlatClientProperties.OUTLINE
.Map<String,Class<?>>
getStyleableInfos()
Object
getStyleableValue(String key)
protected boolean
isCellEditor(Component c)
protected boolean
isEnabled(Component c)
protected boolean
isFocused(Component c)
void
paintBorder(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 int focusWidth
-
innerFocusWidth
protected float innerFocusWidth
-
innerOutlineWidth
protected float innerOutlineWidth
-
borderWidth
protected float borderWidth
- Since:
- 2
-
focusColor
protected Color focusColor
-
borderColor
protected Color borderColor
-
disabledBorderColor
protected Color disabledBorderColor
-
focusedBorderColor
protected Color focusedBorderColor
-
errorBorderColor
protected Color errorBorderColor
-
errorFocusedBorderColor
protected Color errorFocusedBorderColor
-
warningBorderColor
protected Color warningBorderColor
-
warningFocusedBorderColor
protected Color warningFocusedBorderColor
-
customBorderColor
protected Color customBorderColor
-
outline
protected String outline
- Since:
- 2
-
outlineColor
protected Color outlineColor
- Since:
- 2
-
outlineFocusedColor
protected Color outlineFocusedColor
- Since:
- 2
-
-
Method Detail
-
applyStyleProperty
public Object applyStyleProperty(String key, Object value)
- Specified by:
applyStyleProperty
in interfaceFlatStylingSupport.StyleableBorder
- Since:
- 2
-
getStyleableInfos
public Map<String,Class<?>> getStyleableInfos()
- Specified by:
getStyleableInfos
in interfaceFlatStylingSupport.StyleableBorder
- Since:
- 2
-
getStyleableValue
public Object getStyleableValue(String key)
- Specified by:
getStyleableValue
in interfaceFlatStylingSupport.StyleableBorder
- Since:
- 2.5
-
paintBorder
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
- Specified by:
paintBorder
in interfaceBorder
- Overrides:
paintBorder
in 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:
getBorderInsets
in 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 float 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.
-
-