public class Password extends Text
The getText()
method is the text displayed. It returns a string that replaces each character of the password
by the character '●'. The value of the password can be retrieved using getPassword()
.
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Password()
Creates an empty password.
|
Password(java.lang.String password)
Creates a password with an initial content.
|
Password(java.lang.String password,
java.lang.String placeHolder)
Creates a password with an initial content and a place holder.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getPassword()
Gets the text of the password not hidden.
|
java.lang.String |
getText()
Gets the full text of the text field.
|
void |
hideNotify()
This method is called as soon as the renderable is hidden.
|
void |
insert(char c)
Inserts a character in the text field at the caret position.
|
boolean |
isRevealed()
Gets whether or not the password is revealed.
|
void |
reveal(boolean reveal)
Reveals or hides the password.
|
addOnClickListener, addOnTextChangeListener, back, gainFocus, getCaret, getPlaceHolder, getSelection, getSelectionEnd, getSelectionStart, getTextLength, handleEvent, insert, isEmpty, isInState, isShownCaret, lostFocus, removeOnClickListener, removeOnTextChangeListener, renderContent, setActive, setCaret, setPlaceHolder, setSelection, setText, validateContent
addClassSelector, contains, getAttribute, getChild, getChildrenCount, getChildrenElements, getContentBounds, getParentElement, getStyle, hasClassSelector, isTransparent, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidgetAt, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, requestFocus, requestFocus, revalidate, revalidateSubTree, setBounds, setEventHandler, setLocation, setPreferredSize, setSize, setVisible, showNotify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEventHandler, getHeight, getWidth, getX, getY, isShown, repaint, repaint, setEventHandler, showNotify
public Password()
public Password(java.lang.String password)
password
- the password to set.java.lang.NullPointerException
- if the given text is null
.public Password(java.lang.String password, java.lang.String placeHolder)
The place holder is displayed when the password is empty.
password
- the password to set.placeHolder
- the place holder to set.java.lang.NullPointerException
- if one or both the given text and place holder are null
.public java.lang.String getText()
Text
public boolean isRevealed()
true
if the password is revealed, false
otherwise.public void reveal(boolean reveal)
reveal
- true
to reveal the password and false
to hide it.public java.lang.String getPassword()
public void insert(char c)
Text
If a part of the text is selected, it is removed.
If the text is modified, the state listener is notified.
insert
in class Text
c
- the character to insert.Text.addOnTextChangeListener(OnTextChangeListener)
public void hideNotify()
Renderable
hideNotify
in interface Renderable
hideNotify
in class Text