Class PasswordField

All Implemented Interfaces:
HasLocalTransform, CloneableSmartAsset, Collidable, Savable, JmeCloneable, Cloneable

public class PasswordField extends TextField
A special TextField implementation that displays an obscured version of the password the user has entered. In all other ways, it acts exactyl like a TextField.
  • Field Details

  • Constructor Details

  • Method Details

    • setDocumentModel

      protected void setDocumentModel(DocumentModel model)
      Overrides:
      setDocumentModel in class TextField
    • getDocumentModel

      public DocumentModel getDocumentModel()
      Overrides:
      getDocumentModel in class TextField
    • setText

      @StyleAttribute(value="text", lookupDefault=false) public void setText(String s)
      Presets the password text to some value.

      Note: if you find yourself calling this with a user's actual password text then you are probably doing something wrong with password management.

      Note: setting text this way will bypass the input filtering. This is so that it's possible to use special marker characters to tell the difference between a real user-entered password and a token inserted to represent a hash of a previously entered password. This token can then purposely have text that is not allowed in a normal password so as to be distinguishable from a real user-entered password.

      Overrides:
      setText in class TextField
    • getText

      public String getText()
      Returns the raw hidden password text.
      Overrides:
      getText in class TextField
    • getDisplayText

      public String getDisplayText()
      Returns the formatted text as the user will see it.
    • setOutputCharacter

      @StyleAttribute(value="outputCharacter", lookupDefault=false) public void setOutputCharacter(Character c)
      Sets the character used to obscure output. If set to null then the default '*' will be used.
    • getOutputCharacter

      public char getOutputCharacter()
    • setAllowedCharacters

      @StyleAttribute(value="allowedCharacters", lookupDefault=false) public void setAllowedCharacters(Predicate<Character> allowed)
      Sets a predicate that returns true for characters that are allowed in the password field. All other input will be skipped.
    • getAllowedCharacters

      public Predicate<Character> getAllowedCharacters()
    • toString

      public String toString()
      Description copied from class: Spatial
      Returns the Spatial's name followed by the class of the spatial
      Example: "MyNode (com.jme3.scene.Spatial)"
      Overrides:
      toString in class TextField
      Returns:
      Spatial's name followed by the class of the Spatial