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 classprivate classNested classes/interfaces inherited from class BasicTextUI
BasicTextUI.BasicCaret, BasicTextUI.BasicHighlighter -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Colorprivate AtomicBooleanprotected JComponentprivate Insetsprotected Colorprivate DocumentListenerprotected Colorprivate FocusListenerprotected intprotected Colorprotected JComponentprotected Iconprotected intprivate Colorprivate Colorprotected Colorprotected booleanprotected JComponentprotected Icon -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate DimensionapplyExtraSize(Dimension size) private DimensionapplyMinimumWidth(JComponent c, Dimension size, int minimumWidth) protected voidapplyStyle(Object style) protected ObjectapplyStyleProperty(String key, Object value) protected voidprotected Caretprotected JComponentstatic ComponentUIprotected void(package private) static ColorgetBackground(JTextComponent c, Color focusedBackground) protected 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) (package private) Stringprotected 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.(package private) static booleanhasDefaultMargins(JComponent c, Insets defaultMargin) protected booleanprotected booleanprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidvoidprivate void(package private) booleanprotected void(package private) static voidpaintBackground(Graphics g, JTextComponent c, Color focusedBackground) protected 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 voidvoidprivate void(package private) static voidupdateBackground(JTextComponent c, Color background, Color disabledBackground, Color inactiveBackground, Color oldDisabledBackground, Color oldInactiveBackground) protected 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 -
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:
installUIin classBasicTextUI
-
installUIImpl
-
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
-
getStyleType
String getStyleType()- Since:
- 2
-
applyStyle
- Since:
- 2
-
applyStyleProperty
-
getStyleableInfos
- Specified by:
getStyleableInfosin interfaceFlatStylingSupport.StyleableUI- Since:
- 2
-
getStyleableValue
- Specified by:
getStyleableValuein interfaceFlatStylingSupport.StyleableUI- Since:
- 2.5
-
updateBackground
private void updateBackground() -
updateBackground
-
paintSafely
- Overrides:
paintSafelyin classBasicTextUI
-
paintBackground
- Overrides:
paintBackgroundin classBasicTextUI
-
paintBackground
-
getBackground
-
paintPlaceholder
-
paintIcons
-
getPreferredSize
- Overrides:
getPreferredSizein classBasicTextUI
-
getMinimumSize
- Overrides:
getMinimumSizein 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:
getVisibleEditorRectin 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 returnstrailingComponentandclearButton.Note: The components in the array must be in reverse (visual) order.
- Since:
- 2
-
prepareLeadingOrTrailingComponent
- Since:
- 2
-
installLayout
protected void installLayout()- Since:
- 2
-