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.
- UiDefault:
- TextField.font Font, TextField.background Color, TextField.foreground Color also used if not editable, TextField.caretForeground Color, TextField.selectionBackground Color, TextField.selectionForeground Color, TextField.disabledBackground Color used if not enabled, TextField.inactiveBackground Color used if not editable, TextField.inactiveForeground Color used if not enabled (yes, this is confusing; this should be named disabledForeground), TextField.border Border, TextField.margin Insets, TextField.caretBlinkRate int default is 500 milliseconds , Component.minimumWidth int, TextField.placeholderForeground Color, TextField.focusedBackground Color optional, TextField.iconTextGap int optional, default is 4, TextComponent.selectAllOnFocusPolicy String never, once (default) or always, TextComponent.selectAllOnMouseClick boolean
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicTextUI
BasicTextUI.BasicCaret, BasicTextUI.BasicHighlighter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JComponentprotected Colorprotected Colorprotected intprotected Colorprotected JComponentprotected Iconprotected intprotected Colorprotected booleanprotected JComponentprotected Icon -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyStyle(Object style) protected ObjectapplyStyleProperty(String key, Object value) protected voidprotected Caretprotected JComponentstatic ComponentUIprotected voidprotected RectangleReturns the rectangle used to paint leading and trailing icons.protected JComponent[]Returns components placed at the leading side of the text field.protected intprotected InsetsgetStyleableValue(JComponent c, String key) protected JComponent[]Returns components placed at the trailing side of the text field.protected intprotected RectangleReturns the rectangle used for the root view of the text.protected booleanprotected booleanprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidvoidprotected voidprotected voidpaintIcons(Graphics g, Rectangle r) Paints the leading and trailing icons in the given rectangle.protected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidvoidprotected voidMethods inherited from class BasicTextFieldUI
create, getBaseline, getBaselineResizeBehavior, getPropertyPrefixMethods inherited from class BasicTextUI
create, createHighlighter, createKeymap, damageRange, damageRange, getComponent, getEditorKit, getKeymapName, getMaximumSize, getNextVisualPositionFrom, getRootView, getToolTipText, installKeyboardActions, modelChanged, modelToView, modelToView, modelToView2D, paint, setView, uninstallKeyboardActions, update, viewToModel, viewToModel, viewToModel2DMethods inherited from class TextUI
getToolTipText2DMethods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
Field Details
-
minimumWidth
protected int minimumWidth -
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
-
-
Constructor Details
-
FlatTextFieldUI
public FlatTextFieldUI()
-
-
Method Details
-
createUI
-
installUI
- Overrides:
installUIin classBasicTextUI
-
uninstallUI
- Overrides:
uninstallUIin classBasicTextUI
-
installDefaults
protected void installDefaults()- Overrides:
installDefaultsin classBasicTextUI
-
uninstallDefaults
protected void uninstallDefaults()- Overrides:
uninstallDefaultsin classBasicTextUI
-
installListeners
protected void installListeners()- Overrides:
installListenersin classBasicTextUI
-
uninstallListeners
protected void uninstallListeners()- Overrides:
uninstallListenersin classBasicTextUI
-
createCaret
- Overrides:
createCaretin classBasicTextUI
-
propertyChange
- Overrides:
propertyChangein classBasicTextUI
-
installDocumentListener
protected void installDocumentListener()- Since:
- 2
-
documentChanged
- Since:
- 2
-
installStyle
protected void installStyle()- Since:
- 2
-
applyStyle
- Since:
- 2
-
applyStyleProperty
-
getStyleableInfos
- Specified by:
getStyleableInfosin interfaceFlatStylingSupport.StyleableUI- Since:
- 2
-
getStyleableValue
- Specified by:
getStyleableValuein interfaceFlatStylingSupport.StyleableUI- Since:
- 2.5
-
paintSafely
- Overrides:
paintSafelyin classBasicTextUI
-
paintBackground
- Overrides:
paintBackgroundin classBasicTextUI
-
paintPlaceholder
-
paintIcons
-
getPreferredSize
- Overrides:
getPreferredSizein classBasicTextUI
-
getMinimumSize
- Overrides:
getMinimumSizein classBasicTextUI
-
getVisibleEditorRect
Returns the rectangle used for the root view of the text. This method is used to place the text.- Overrides:
getVisibleEditorRectin classBasicTextUI
-
getIconsRect
Returns the rectangle used to paint leading and trailing icons. It invokessuper.getVisibleEditorRect()and reduces left and/or right insets 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
-
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 returnstrailingComponentandclearButton.Note: The components in the array must be in reverse (visual) order.
- Since:
- 2
-
prepareLeadingOrTrailingComponent
- Since:
- 2
-
installLayout
protected void installLayout()- Since:
- 2
-