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,java.io.Serializable,javax.swing.border.Border,javax.swing.plaf.UIResource
- Direct Known Subclasses:
FlatButtonBorder,FlatRoundBorder,FlatScrollPaneBorder,FlatTextBorder
public class FlatBorder extends javax.swing.plaf.basic.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
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.ColorborderColorprotected floatborderWidthprotected java.awt.ColorcustomBorderColorprotected java.awt.ColordisabledBorderColorprotected java.awt.ColorerrorBorderColorprotected java.awt.ColorerrorFocusedBorderColorprotected java.awt.ColorfocusColorprotected java.awt.ColorfocusedBorderColorprotected intfocusWidthprotected floatinnerFocusWidthprotected floatinnerOutlineWidthprotected java.lang.Stringoutlineprotected java.awt.ColoroutlineColorprotected java.awt.ColoroutlineFocusedColorprotected java.awt.ColorsuccessBorderColorprotected java.awt.ColorsuccessFocusedBorderColorprotected java.awt.ColorwarningBorderColorprotected java.awt.ColorwarningFocusedBorderColor
-
Constructor Summary
Constructors Constructor Description FlatBorder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectapplyStyleProperty(java.lang.String key, java.lang.Object value)protected intgetArc(java.awt.Component c)Returns the (unscaled) arc diameter of the border corners.protected java.awt.PaintgetBorderColor(java.awt.Component c)java.awt.InsetsgetBorderInsets(java.awt.Component c, java.awt.Insets insets)protected floatgetBorderWidth(java.awt.Component c)Returns the (unscaled) line thickness used to paint the border.protected java.awt.ColorgetFocusColor(java.awt.Component c)protected intgetFocusWidth(java.awt.Component c)Returns the (unscaled) thickness of the outer focus border.protected floatgetInnerFocusWidth(java.awt.Component c)Returns the (unscaled) thickness of the inner focus border.protected intgetLineWidth(java.awt.Component c)Returns the (unscaled) line thickness used to compute the border insets.protected java.awt.ColorgetOutlineColor(java.awt.Component c)Returns the outline color of the component border specified in client propertyFlatClientProperties.OUTLINE.java.util.Map<java.lang.String,java.lang.Class<?>>getStyleableInfos()java.lang.ObjectgetStyleableValue(java.lang.String key)protected booleanisCellEditor(java.awt.Component c)protected booleanisEnabled(java.awt.Component c)protected booleanisFocused(java.awt.Component c)voidpaintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
-
-
-
Field Detail
-
focusWidth
protected int focusWidth
-
innerFocusWidth
protected float innerFocusWidth
-
innerOutlineWidth
protected float innerOutlineWidth
-
borderWidth
protected float borderWidth
- Since:
- 2
-
focusColor
protected java.awt.Color focusColor
-
borderColor
protected java.awt.Color borderColor
-
disabledBorderColor
protected java.awt.Color disabledBorderColor
-
focusedBorderColor
protected java.awt.Color focusedBorderColor
-
errorBorderColor
protected java.awt.Color errorBorderColor
-
errorFocusedBorderColor
protected java.awt.Color errorFocusedBorderColor
-
warningBorderColor
protected java.awt.Color warningBorderColor
-
warningFocusedBorderColor
protected java.awt.Color warningFocusedBorderColor
-
successBorderColor
protected java.awt.Color successBorderColor
- Since:
- 3.6
-
successFocusedBorderColor
protected java.awt.Color successFocusedBorderColor
- Since:
- 3.6
-
customBorderColor
protected java.awt.Color customBorderColor
-
outline
protected java.lang.String outline
- Since:
- 2
-
outlineColor
protected java.awt.Color outlineColor
- Since:
- 2
-
outlineFocusedColor
protected java.awt.Color outlineFocusedColor
- Since:
- 2
-
-
Method Detail
-
applyStyleProperty
public java.lang.Object applyStyleProperty(java.lang.String key, java.lang.Object value)- Specified by:
applyStylePropertyin interfaceFlatStylingSupport.StyleableBorder- Since:
- 2
-
getStyleableInfos
public java.util.Map<java.lang.String,java.lang.Class<?>> getStyleableInfos()
- Specified by:
getStyleableInfosin interfaceFlatStylingSupport.StyleableBorder- Since:
- 2
-
getStyleableValue
public java.lang.Object getStyleableValue(java.lang.String key)
- Specified by:
getStyleableValuein interfaceFlatStylingSupport.StyleableBorder- Since:
- 2.5
-
paintBorder
public void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)- Specified by:
paintBorderin interfacejavax.swing.border.Border- Overrides:
paintBorderin classjavax.swing.border.AbstractBorder
-
getOutlineColor
protected java.awt.Color getOutlineColor(java.awt.Component c)
Returns the outline color of the component border specified in client propertyFlatClientProperties.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:
getBorderInsetsin classjavax.swing.plaf.basic.BasicBorders.MarginBorder
-
getFocusWidth
protected int getFocusWidth(java.awt.Component c)
Returns the (unscaled) thickness of the outer focus border.
-
getInnerFocusWidth
protected float getInnerFocusWidth(java.awt.Component c)
Returns the (unscaled) thickness of the inner 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 togetBorderWidth(java.awt.Component).
-
getBorderWidth
protected float getBorderWidth(java.awt.Component c)
Returns the (unscaled) line thickness used to paint the border. This may be different togetLineWidth(java.awt.Component).
-
getArc
protected int getArc(java.awt.Component c)
Returns the (unscaled) arc diameter of the border corners.
-
-