Class JPasswordField

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants

public class JPasswordField extends JTextField
Emulator for JPasswordField.
See Also:
  • Constructor Details

    • JPasswordField

      public JPasswordField()
    • JPasswordField

      public JPasswordField(String text)
    • JPasswordField

      public JPasswordField(int columns)
    • JPasswordField

      public JPasswordField(String text, int columns)
    • JPasswordField

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

    • getPassword

      public char[] getPassword()
      Returns:
      a fresh array the caller should zero after use, or null when the Document refuses to hand over its text, as in the JDK
    • getText

      @Deprecated public String getText()
      Deprecated.
      per the JDK. Prefer getPassword(): this returns an immutable String that cannot be zeroed after use.
      Returns cleartext, as the JDK does. Kept as an override — rather than inherited — because that is exactly what the JDK does: both bodies are return super.getText(...) and exist only to carry @Deprecated, so a migrator recompiling against SB-Emulators keeps the javac warning their Swing build already emitted.
      Overrides:
      getText in class JTextComponent
    • getText

      @Deprecated public String getText(int offs, int len) throws BadLocationException
      Deprecated.
      per the JDK; see getText().
      Overrides:
      getText in class JTextComponent
      Throws:
      BadLocationException
    • getEchoChar

      public char getEchoChar()
    • setEchoChar

      public void setEchoChar(char c)
    • echoCharIsSet

      public boolean echoCharIsSet()
    • copy

      public void copy()
      Overrides:
      copy in class JTextComponent
    • cut

      public void cut()
      Overrides:
      cut in class JTextComponent
    • getUIClassID

      public String getUIClassID()
      Overrides:
      getUIClassID in class JTextField
    • paramString

      protected String paramString()
      Overrides:
      paramString in class JTextField
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible
      Overrides:
      getAccessibleContext in class JTextField