Class FlatTextFieldUI

  • All Implemented Interfaces:
    FlatStylingSupport.StyleableUI, ViewFactory
    Direct Known Subclasses:
    FlatFormattedTextFieldUI, FlatPasswordFieldUI

    public class FlatTextFieldUI
    extends BasicTextFieldUI
    implements FlatStylingSupport.StyleableUI
    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, Component.isIntelliJTheme boolean, 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
    • Field Detail

      • minimumWidth

        protected int minimumWidth
      • isIntelliJTheme

        protected boolean isIntelliJTheme
      • disabledBackground

        protected Color disabledBackground
      • inactiveBackground

        protected Color inactiveBackground
      • placeholderForeground

        protected Color placeholderForeground
      • focusedBackground

        protected Color focusedBackground
      • iconTextGap

        protected int iconTextGap
        Since:
        2
      • leadingIcon

        protected Icon leadingIcon
        Since:
        2
      • trailingIcon

        protected Icon trailingIcon
        Since:
        2
      • leadingComponent

        protected JComponent leadingComponent
        Since:
        2
      • trailingComponent

        protected JComponent trailingComponent
        Since:
        2
      • clearButton

        protected JComponent clearButton
        Since:
        2
      • showClearButton

        protected boolean showClearButton
        Since:
        2
    • Constructor Detail

      • FlatTextFieldUI

        public FlatTextFieldUI()
    • Method Detail

      • installDocumentListener

        protected void installDocumentListener()
        Since:
        2
      • documentChanged

        protected void documentChanged​(DocumentEvent e)
        Since:
        2
      • installStyle

        protected void installStyle()
        Since:
        2
      • applyStyle

        protected void applyStyle​(Object style)
        Since:
        2
      • applyStyleProperty

        protected Object applyStyleProperty​(String key,
                                            Object value)
        Since:
        2
      • paintPlaceholder

        protected void paintPlaceholder​(Graphics g)
      • paintIcons

        protected void paintIcons​(Graphics g,
                                  Rectangle r)
        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
      • getVisibleEditorRect

        protected Rectangle getVisibleEditorRect()
        Returns the rectangle used for the root view of the text. This method is used to place the text.
        Overrides:
        getVisibleEditorRect in class BasicTextUI
      • getIconsRect

        protected Rectangle getIconsRect()
        Returns the rectangle used to paint leading and trailing icons. It invokes super.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

        protected Insets 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

        protected JComponent createClearButton()
        Since:
        2
      • clearButtonClicked

        protected void clearButtonClicked()
        Since:
        2
      • updateClearButton

        protected void updateClearButton()
        Since:
        2
      • getLeadingComponents

        protected JComponent[] getLeadingComponents()
        Returns components placed at the leading side of the text field. The returned array may contain null. The default implementation returns leadingComponent.
        Since:
        2
      • getTrailingComponents

        protected JComponent[] getTrailingComponents()
        Returns components placed at the trailing side of the text field. The returned array may contain null. The default implementation returns trailingComponent and clearButton.

        Note: The components in the array must be in reverse (visual) order.

        Since:
        2
      • prepareLeadingOrTrailingComponent

        protected void prepareLeadingOrTrailingComponent​(JComponent c)
        Since:
        2
      • installLayout

        protected void installLayout()
        Since:
        2