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.
- Author:
- Karl Tauber
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.plaf.basic.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 javax.swing.plaf.basic.BasicTextFieldUI
create, getBaseline, getBaselineResizeBehavior, getPropertyPrefixMethods 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, viewToModel2DMethods inherited from class javax.swing.plaf.TextUI
getToolTipText2DMethods inherited from class javax.swing.plaf.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
- Since:
- 2
-
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
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:
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 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
-
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
-