Package com.formdev.flatlaf.ui
Class FlatTextFieldUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TextUI
javax.swing.plaf.basic.BasicTextUI
javax.swing.plaf.basic.BasicTextFieldUI
com.formdev.flatlaf.ui.FlatTextFieldUI
- All Implemented Interfaces:
FlatStylingSupport.StyleableUI
,ViewFactory
- Direct Known Subclasses:
FlatFormattedTextFieldUI
,FlatPasswordFieldUI
Provides the Flat LaF UI delegate for
JTextField
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
private class
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTextUI
BasicTextUI.BasicCaret, BasicTextUI.BasicHighlighter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Color
private AtomicBoolean
protected JComponent
private Insets
protected Color
private DocumentListener
protected Color
private FocusListener
protected int
protected Color
protected JComponent
protected Icon
protected int
private Color
private Color
protected Color
protected boolean
protected JComponent
protected Icon
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Dimension
applyExtraSize
(Dimension size) private Dimension
applyMinimumWidth
(JComponent c, Dimension size, int minimumWidth) protected void
applyStyle
(Object style) protected Object
applyStyleProperty
(String key, Object value) protected void
protected Caret
protected JComponent
static ComponentUI
protected void
(package private) static Color
getBackground
(JTextComponent c, Color focusedBackground) protected Rectangle
Returns the rectangle used to paint leading and trailing icons.protected JComponent[]
Returns components placed at the leading side of the text field.protected int
protected Insets
getStyleableValue
(JComponent c, String key) (package private) String
protected JComponent[]
Returns components placed at the trailing side of the text field.protected int
protected Rectangle
Returns the rectangle used for the root view of the text.(package private) static boolean
hasDefaultMargins
(JComponent c, Insets defaultMargin) protected boolean
protected boolean
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
void
private void
(package private) boolean
protected void
(package private) static void
paintBackground
(Graphics g, JTextComponent c, Color focusedBackground) protected void
paintIcons
(Graphics g, Rectangle r) Paints the leading and trailing icons in the given rectangle.protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
void
private void
(package private) static void
updateBackground
(JTextComponent c, Color background, Color disabledBackground, Color inactiveBackground, Color oldDisabledBackground, Color oldInactiveBackground) protected void
Methods inherited from class javax.swing.plaf.basic.BasicTextFieldUI
create, getBaseline, getBaselineResizeBehavior, getPropertyPrefix
Methods inherited from class javax.swing.plaf.basic.BasicTextUI
create, createHighlighter, createKeymap, damageRange, damageRange, getComponent, getEditorKit, getKeymapName, getMaximumSize, getNextVisualPositionFrom, getRootView, getToolTipText, installKeyboardActions, modelChanged, modelToView, modelToView, modelToView2D, paint, setView, uninstallKeyboardActions, update, viewToModel, viewToModel, viewToModel2D
Methods inherited from class javax.swing.plaf.TextUI
getToolTipText2D
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
Field Details
-
minimumWidth
protected int minimumWidth -
background
-
disabledBackground
-
inactiveBackground
-
placeholderForeground
-
focusedBackground
-
iconTextGap
protected int iconTextGap- Since:
- 2
-
leadingIcon
- Since:
- 2
-
trailingIcon
- Since:
- 2
-
leadingComponent
- Since:
- 2
-
trailingComponent
- Since:
- 2
-
clearButton
- Since:
- 2
-
showClearButton
protected boolean showClearButton- Since:
- 2
-
oldDisabledBackground
-
oldInactiveBackground
-
defaultMargin
-
focusListener
-
documentListener
-
oldStyleValues
-
-
Constructor Details
-
FlatTextFieldUI
public FlatTextFieldUI()
-
-
Method Details
-
createUI
-
installUI
- Overrides:
installUI
in classBasicTextUI
-
installUIImpl
-
uninstallUI
- Overrides:
uninstallUI
in classBasicTextUI
-
installDefaults
protected void installDefaults()- Overrides:
installDefaults
in classBasicTextUI
-
uninstallDefaults
protected void uninstallDefaults()- Overrides:
uninstallDefaults
in classBasicTextUI
-
installListeners
protected void installListeners()- Overrides:
installListeners
in classBasicTextUI
-
uninstallListeners
protected void uninstallListeners()- Overrides:
uninstallListeners
in classBasicTextUI
-
createCaret
- Overrides:
createCaret
in classBasicTextUI
-
propertyChange
- Overrides:
propertyChange
in classBasicTextUI
-
installDocumentListener
protected void installDocumentListener()- Since:
- 2
-
documentChanged
- Since:
- 2
-
installStyle
protected void installStyle()- Since:
- 2
-
getStyleType
String getStyleType()- Since:
- 2
-
applyStyle
- Since:
- 2
-
applyStyleProperty
- Since:
- 2
-
getStyleableInfos
- Specified by:
getStyleableInfos
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2
-
getStyleableValue
- Specified by:
getStyleableValue
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2.5
-
updateBackground
private void updateBackground() -
updateBackground
-
paintSafely
- Overrides:
paintSafely
in classBasicTextUI
-
paintBackground
- Overrides:
paintBackground
in classBasicTextUI
-
paintBackground
-
getBackground
-
paintPlaceholder
-
paintIcons
Paints the leading and trailing icons in the given rectangle. The rectangle is updated by this method so that subclasses can use it without painting over leading or trailing icons.- Since:
- 2
-
getPreferredSize
- Overrides:
getPreferredSize
in classBasicTextUI
-
getMinimumSize
- Overrides:
getMinimumSize
in classBasicTextUI
-
applyExtraSize
-
applyMinimumWidth
-
hasDefaultMargins
-
getVisibleEditorRect
Returns the rectangle used for the root view of the text. This method is used to place the text.- Overrides:
getVisibleEditorRect
in classBasicTextUI
-
getIconsRect
Returns the rectangle used to paint leading and trailing icons. It invokessuper.getVisibleEditorRect()
and reduces left and/or right margin if the text field has leading or trailing icons or components. Also, the preferred widths of leading and trailing components are removed.- Since:
- 2
-
hasLeadingIcon
protected boolean hasLeadingIcon()- Since:
- 2
-
hasTrailingIcon
protected boolean hasTrailingIcon()- Since:
- 2
-
getLeadingIconWidth
protected int getLeadingIconWidth()- Since:
- 2
-
getTrailingIconWidth
protected int getTrailingIconWidth()- Since:
- 2
-
isLeftToRight
boolean isLeftToRight() -
getPadding
- Since:
- 1.4
-
scrollCaretToVisible
protected void scrollCaretToVisible()- Since:
- 1.4
-
installLeadingComponent
protected void installLeadingComponent()- Since:
- 2
-
installTrailingComponent
protected void installTrailingComponent()- Since:
- 2
-
uninstallLeadingComponent
protected void uninstallLeadingComponent()- Since:
- 2
-
uninstallTrailingComponent
protected void uninstallTrailingComponent()- Since:
- 2
-
installClearButton
protected void installClearButton()- Since:
- 2
-
uninstallClearButton
protected void uninstallClearButton()- Since:
- 2
-
createClearButton
- Since:
- 2
-
clearButtonClicked
protected void clearButtonClicked()- Since:
- 2
-
updateClearButton
protected void updateClearButton()- Since:
- 2
-
getLeadingComponents
Returns components placed at the leading side of the text field. The returned array may containnull
. The default implementation returnsleadingComponent
.- Since:
- 2
-
getTrailingComponents
Returns components placed at the trailing side of the text field. The returned array may containnull
. The default implementation returnstrailingComponent
andclearButton
.Note: The components in the array must be in reverse (visual) order.
- Since:
- 2
-
prepareLeadingOrTrailingComponent
- Since:
- 2
-
installLayout
protected void installLayout()- Since:
- 2
-