Class TextComponentUtils


  • public class TextComponentUtils
    extends java.lang.Object
    Utility class for JTextComponent related functions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void setActionNextFocus​(@NotNull javax.swing.JTextField textField, @NotNull java.awt.Component nextComponent)
      Transfers the focus to another component when ENTER is pressed.
      static void setAutoSelectOnFocus​(@NotNull javax.swing.text.JTextComponent textComponent)
      Selects all text of a JTextComponent when the component gains the focus.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setAutoSelectOnFocus

        public static void setAutoSelectOnFocus​(@NotNull
                                                @NotNull javax.swing.text.JTextComponent textComponent)
        Selects all text of a JTextComponent when the component gains the focus.
        Parameters:
        textComponent - the text component
      • setActionNextFocus

        public static void setActionNextFocus​(@NotNull
                                              @NotNull javax.swing.JTextField textField,
                                              @NotNull
                                              @NotNull java.awt.Component nextComponent)
        Transfers the focus to another component when ENTER is pressed.
        Parameters:
        textField - the text field to track
        nextComponent - the component to transfer the focus to