Module MaterialFX

Class MFXPasswordField

All Implemented Interfaces:
MFXMenuControl, Validated, Styleable, EventTarget, Skinnable

public class MFXPasswordField extends MFXTextField
This is my implementation of a password field, a TextField which masks the given input text.

Extends MFXTextField, starts with a default trailing icon which allows to show/hide the password and it's defined by the defaultTrailingIcon() method so it can be changed after instantiation or by overriding the method.

Specific features:

- Allows to change the "mask" character, even at runtime

- Allows to show/hide the password.

- Allows to copy the selected text (Ctrl + C)

- Allows to cut the selected text (Ctrl + X)

- Allows to paste the text in the clipboard to the field (Ctrl + V)

- Allows to enable/disable copy, cut and paste at any time

- Introduces a new PseudoClass, ":masked" that activates when the text is masked

  • Property Details

  • Field Details

  • Constructor Details

    • MFXPasswordField

      public MFXPasswordField()
    • MFXPasswordField

      public MFXPasswordField(String text)
    • MFXPasswordField

      public MFXPasswordField(String text, String promptText)
    • MFXPasswordField

      public MFXPasswordField(String text, String promptText, String floatingText)
  • Method Details

    • setBehavior

      protected void setBehavior()
      Sets the default behavior for the password field such:

      - Avoid worlds selection and only allowing selectAll()

      - Managing the ":masked" PseudoClass

    • defaultTrailingIcon

      protected void defaultTrailingIcon()
      Sets the default trailing icon for the password field.

      An eye to show/hide the password.

    • defaultContextMenu

      public void defaultContextMenu()
      Overrides:
      defaultContextMenu in class MFXTextField
    • copy

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

      public void cut()
      Overrides:
      cut in class MFXTextField
    • paste

      public void paste()
      Overrides:
      paste in class MFXTextField
    • previousWord

      public void previousWord()
      Overrides:
      previousWord in class MFXTextField
    • nextWord

      public void nextWord()
      Overrides:
      nextWord in class MFXTextField
    • endOfNextWord

      public void endOfNextWord()
      Overrides:
      endOfNextWord in class MFXTextField
    • selectPreviousWord

      public void selectPreviousWord()
      Overrides:
      selectPreviousWord in class MFXTextField
    • selectNextWord

      public void selectNextWord()
      Overrides:
      selectNextWord in class MFXTextField
    • selectEndOfNextWord

      public void selectEndOfNextWord()
      Overrides:
      selectEndOfNextWord in class MFXTextField
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class MFXTextField
    • isAllowCopy

      public boolean isAllowCopy()
      Gets the value of the property allowCopy.
      Property description:
      Specifies if copying the password field text is allowed.
    • allowCopyProperty

      public StyleableBooleanProperty allowCopyProperty()
      Specifies if copying the password field text is allowed.
      See Also:
    • setAllowCopy

      public void setAllowCopy(boolean allowCopy)
      Sets the value of the property allowCopy.
      Property description:
      Specifies if copying the password field text is allowed.
    • isAllowCut

      public boolean isAllowCut()
      Gets the value of the property allowCut.
      Property description:
      Specifies if it's allowed to cut text from the password field.
    • allowCutProperty

      public StyleableBooleanProperty allowCutProperty()
      Specifies if it's allowed to cut text from the password field.
      See Also:
    • setAllowCut

      public void setAllowCut(boolean allowCut)
      Sets the value of the property allowCut.
      Property description:
      Specifies if it's allowed to cut text from the password field.
    • isAllowPaste

      public boolean isAllowPaste()
      Gets the value of the property allowPaste.
      Property description:
      Specifies if it's allowed to paste text from the clipboard to the field.
    • allowPasteProperty

      public StyleableBooleanProperty allowPasteProperty()
      Specifies if it's allowed to paste text from the clipboard to the field.
      See Also:
    • setAllowPaste

      public void setAllowPaste(boolean allowPaste)
      Sets the value of the property allowPaste.
      Property description:
      Specifies if it's allowed to paste text from the clipboard to the field.
    • isShowPassword

      public boolean isShowPassword()
      Gets the value of the property showPassword.
      Property description:
      Specifies if the text should be un-masked to show the password.
    • showPasswordProperty

      public StyleableBooleanProperty showPasswordProperty()
      Specifies if the text should be un-masked to show the password.
      See Also:
    • setShowPassword

      public void setShowPassword(boolean showPassword)
      Sets the value of the property showPassword.
      Property description:
      Specifies if the text should be un-masked to show the password.
    • getHideCharacter

      public String getHideCharacter()
      Gets the value of the property hideCharacter.
      Property description:
      Specifies the character used to mask the text.
    • hideCharacterProperty

      public StyleableStringProperty hideCharacterProperty()
      Specifies the character used to mask the text.
      See Also:
    • setHideCharacter

      public void setHideCharacter(String hideCharacter)
      Sets the value of the property hideCharacter.
      Property description:
      Specifies the character used to mask the text.
    • getClassCssMetaData

      public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
    • getControlCssMetaData

      public List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
      Overrides:
      getControlCssMetaData in class MFXTextField