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.
  • Field Details

    • minimumWidth

      protected int minimumWidth
    • background

      private Color background
    • 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
    • oldDisabledBackground

      private Color oldDisabledBackground
    • oldInactiveBackground

      private Color oldInactiveBackground
    • defaultMargin

      private Insets defaultMargin
    • focusListener

      private FocusListener focusListener
    • documentListener

      private DocumentListener documentListener
    • oldStyleValues

      private Map<String,Object> oldStyleValues
    • borderShared

      private AtomicBoolean borderShared
  • Constructor Details

    • FlatTextFieldUI

      public FlatTextFieldUI()
  • Method Details

    • createUI

      public static ComponentUI createUI(JComponent c)
    • installUI

      public void installUI(JComponent c)
      Overrides:
      installUI in class BasicTextUI
    • installUIImpl

      private void installUIImpl(JComponent c)
    • uninstallUI

      public void uninstallUI(JComponent c)
      Overrides:
      uninstallUI in class BasicTextUI
    • installDefaults

      protected void installDefaults()
      Overrides:
      installDefaults in class BasicTextUI
    • uninstallDefaults

      protected void uninstallDefaults()
      Overrides:
      uninstallDefaults in class BasicTextUI
    • installListeners

      protected void installListeners()
      Overrides:
      installListeners in class BasicTextUI
    • uninstallListeners

      protected void uninstallListeners()
      Overrides:
      uninstallListeners in class BasicTextUI
    • createCaret

      protected Caret createCaret()
      Overrides:
      createCaret in class BasicTextUI
    • propertyChange

      protected void propertyChange(PropertyChangeEvent e)
      Overrides:
      propertyChange in class BasicTextUI
    • installDocumentListener

      protected void installDocumentListener()
      Since:
      2
    • documentChanged

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

      protected void installStyle()
      Since:
      2
    • getStyleType

      String getStyleType()
      Since:
      2
    • applyStyle

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

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

      public Map<String,Class<?>> getStyleableInfos(JComponent c)
      Specified by:
      getStyleableInfos in interface FlatStylingSupport.StyleableUI
      Since:
      2
    • getStyleableValue

      public Object getStyleableValue(JComponent c, String key)
      Specified by:
      getStyleableValue in interface FlatStylingSupport.StyleableUI
      Since:
      2.5
    • updateBackground

      private void updateBackground()
    • updateBackground

      static void updateBackground(JTextComponent c, Color background, Color disabledBackground, Color inactiveBackground, Color oldDisabledBackground, Color oldInactiveBackground)
    • paintSafely

      protected void paintSafely(Graphics g)
      Overrides:
      paintSafely in class BasicTextUI
    • paintBackground

      protected void paintBackground(Graphics g)
      Overrides:
      paintBackground in class BasicTextUI
    • paintBackground

      static void paintBackground(Graphics g, JTextComponent c, Color focusedBackground)
    • getBackground

      static Color getBackground(JTextComponent c, Color focusedBackground)
    • 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
    • getPreferredSize

      public Dimension getPreferredSize(JComponent c)
      Overrides:
      getPreferredSize in class BasicTextUI
    • getMinimumSize

      public Dimension getMinimumSize(JComponent c)
      Overrides:
      getMinimumSize in class BasicTextUI
    • applyExtraSize

      private Dimension applyExtraSize(Dimension size)
    • applyMinimumWidth

      private Dimension applyMinimumWidth(JComponent c, Dimension size, int minimumWidth)
    • hasDefaultMargins

      static boolean hasDefaultMargins(JComponent c, Insets defaultMargin)
    • 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
    • isLeftToRight

      boolean isLeftToRight()
    • 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