Class SJTextField

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.textfield.TextField, String>
com.vaadin.flow.component.AbstractSinglePropertyField<com.vaadin.flow.component.textfield.TextField, String>
com.vaadin.flow.component.textfield.TextFieldBase<com.vaadin.flow.component.textfield.TextField, String>
com.vaadin.flow.component.textfield.TextField
com.vaadin.swingbridge.surrogates.SJTextField
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.textfield.TextField>, com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.textfield.TextField>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.textfield.TextField>, com.vaadin.flow.component.HasAriaDescription, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasPlaceholder, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField, String>, String>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField, String>, String>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, com.vaadin.flow.component.shared.HasAllowedCharPattern, com.vaadin.flow.component.shared.HasClearButton, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.textfield.TextFieldVariant>, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField, String>, String>, com.vaadin.flow.component.textfield.HasAutocapitalize, com.vaadin.flow.component.textfield.HasAutocomplete, com.vaadin.flow.component.textfield.HasAutocorrect, com.vaadin.flow.data.binder.HasValidator<String>, com.vaadin.flow.data.value.HasValueChangeMode, ComponentMixin, ContainerMixin, EnterClaims.Claimant, JComponentMixin, JTextComponentMixin, Serializable
Direct Known Subclasses:
SJFormattedTextField

public class SJTextField extends com.vaadin.flow.component.textfield.TextField implements JTextComponentMixin, EnterClaims.Claimant
Surrogate for JTextField (SD_sjtextfield). Extends Vaadin TextField directly (is-a). Reaches the migrator either through :emulators.JTextField as peer, or as a richer-than-stock Vaadin component in its own right. First concrete consumer of JTextComponentMixin; future SJPasswordField + SJTextArea follow the same shape.

Override surface against JTextComponentMixin

  • validate() — visibility-widening override required by ComponentMixin's public validate() contract. Vaadin TextField declares the inherited validate() as protected (input validation, not Swing's layout cycle). Same shape SJToggleButton takes per SD_toggle_checkbox_first_cut.

JTextField-specific surface

  • columns — setColumns(int) writes peer.setWidth of a CssConvert.columnsToCssWidth(int) character-column hint per R_layouts_close_enough close-enough; negative throws IAE per R_match_swing_errors.
  • horizontalAlignment — drop-and-WARN per SD_sjtextfield (Vaadin TextField shadow DOM doesn't honor host text-align). R_match_swing_errors IAE on bad axis preserved.
  • ActionListener wiring on Enter — Vaadin addKeyPressListener(Key.ENTER, ...) → fires ActionEvent with source = this and actionCommand falling back to text. Listener list lives on the concrete (not in the mixin store) since JTextArea doesn't have ActionListener support.
  • setAction(Action) — narrow propagation per JDK: enabled / SHORT_DESCRIPTION / ACTION_COMMAND_KEY only. Doesn't copy NAME (would overwrite form data) or icons or mnemonics.
  • getUIClassID() == "TextFieldUI".
See Also:
  • Constructor Details

    • SJTextField

      public SJTextField()
    • SJTextField

      public SJTextField(String text)
    • SJTextField

      public SJTextField(int columns)
    • SJTextField

      public SJTextField(String text, int columns)
    • SJTextField

      public SJTextField(Document doc, String text, int columns)
  • Method Details

    • validate

      public void validate()
      Visibility-widening override of TextField.validate() to satisfy ComponentMixin's public validate() contract. Delegates to super so Vaadin's input-validation behaviour is preserved. Same SJToggleButton pattern per SD_toggle_checkbox_first_cut (method-name clash between Swing's "validate the layout" and Vaadin's "validate the input value" — same name, different concerns).
      Specified by:
      validate in interface ComponentMixin
      Overrides:
      validate in class com.vaadin.flow.component.textfield.TextField
    • getColumns

      public int getColumns()
    • setColumns

      public void setColumns(int columns)
    • getHorizontalAlignment

      public int getHorizontalAlignment()
    • setHorizontalAlignment

      public void setHorizontalAlignment(int alignment)
    • addActionListener

      public void addActionListener(ActionListener l)
    • removeActionListener

      public void removeActionListener(ActionListener l)
    • getActionListeners

      public ActionListener[] getActionListeners()
    • fireActionPerformed

      protected void fireActionPerformed()
      Fire ActionEvent with source = this and actionCommand falling back to current text. EventListenerList.getListeners returns LIFO order already; iterate directly. Public entry point for harness code is postActionEvent().
    • setActionCommand

      public void setActionCommand(String command)
    • postActionEvent

      public void postActionEvent()
      Public synthesizer matching JDK — useful when not Enter-triggered.
    • getAction

      public Action getAction()
    • setAction

      public void setAction(Action a)
    • configurePropertiesFromAction

      protected void configurePropertiesFromAction(Action a)
      JDK JTextField's narrow Action property set: enabled / SHORT_DESCRIPTION / ACTION_COMMAND_KEY. No NAME propagation (would overwrite form data); no icons or mnemonics.
    • createActionPropertyChangeListener

      protected PropertyChangeListener createActionPropertyChangeListener(Action a)
    • actionPropertyChanged

      protected void actionPropertyChanged(Action a, String propertyName)
    • claimsEnter

      public boolean claimsEnter()
      Enter posts an ActionEvent when anyone listens for one — Swing's notify-field-accept, enabled by hasActionListener(). An setAction(Action) counts: it installs the action as a listener.
      Specified by:
      claimsEnter in interface EnterClaims.Claimant
    • getUIClassID

      public String getUIClassID()
      Description copied from interface: JComponentMixin
      Deliberate no-op — L&F key.
      Specified by:
      getUIClassID in interface JComponentMixin
    • paramString

      protected String paramString()
      JDK JTextField.paramString chains AbstractButton-style; we skip the full chain (Vaadin Component.toString is the honest host-side equivalent) and report the JTextField-specific tail.
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()