public interface ITextField
JTextField
.Modifier and Type | Interface and Description |
---|---|
static interface |
ITextField.IValidator
Simple validator.
|
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
ERROR_COLOR
Error background color to be set if a validation fails.
|
Modifier and Type | Method and Description |
---|---|
javax.swing.JTextField |
asTextField()
Casts this instance to
JTextField . |
ITextField.IValidator |
getValidator()
Returns the validator of the text field.
|
void |
registerFocusHotkey(javax.swing.JComponent rootComponent,
javax.swing.KeyStroke keyStroke)
Registers the specified key stroke at the specified root component to focus the text field when the key stroke is pressed.
|
void |
setText(java.lang.String text)
Sets the specified text if it's different from the current text.
|
void |
setValidator(ITextField.IValidator validator)
Sets a simple real-time validator to the text field.
|
static final java.awt.Color ERROR_COLOR
javax.swing.JTextField asTextField()
JTextField
.this
as a JTextField
void setText(java.lang.String text)
text
- text to be setvoid registerFocusHotkey(javax.swing.JComponent rootComponent, javax.swing.KeyStroke keyStroke)
If the text field already has an explicitly set tool tip (set by JComponent.setToolTipText(String)
), it will be extended with a string
representation of the key stroke.
If the explicitly set tool tip is an HTML tool tip and ends with "</html>
, the key stroke string will be inserted before the closing
HTML tag.
rootComponent
- root component to register the specified stroke atkeyStroke
- key stroke to be registered to focus the text field when pressedvoid setValidator(ITextField.IValidator validator)
The validator will be called each time the text of the text field changes, and if the validator returns false
, red background will indicate
the failure.
If a validator has been previously set, it will be removed first. You can set a null
validator to remove the current validator.
validator
- validator to be added, may be null
ITextField.IValidator getValidator()
This API documentation is public and is intended for / allowed to be used by anyone.
Scelight home page: https://sites.google.com/site/scelight/
Scelight is a trademark of András Belicza. Copyright © András Belicza, 2013-2015. All rights reserved.