public class JComponentInputVerifier extends InputVerifier implements KeyListener
Constructor and Description |
---|
JComponentInputVerifier(IValidator aValidator)
Creates a new AbstractValidator instance.
|
JComponentInputVerifier(String aMessage,
IValidator aValidator)
Creates a new AbstractValidator instance.
|
Modifier and Type | Method and Description |
---|---|
static JComponentInputVerifier |
create(Class<?> aType)
Creates an instance of this InputVerifier for the given type.
|
static JComponentInputVerifier |
create(Class<?> aType,
String aMessage)
Creates an instance of this InputVerifier for the given type.
|
protected Object |
getInputValue(Component aComponent)
Tries to obtain the actual value of a given component.
|
protected String |
getMessage()
Returns the message to use when validation fails.
|
void |
keyPressed(KeyEvent aEvent) |
void |
keyReleased(KeyEvent aEvent) |
void |
keyTyped(KeyEvent aEvent) |
boolean |
verify(JComponent aInput) |
shouldYieldFocus
public JComponentInputVerifier(IValidator aValidator)
aValidator
- the validator to use for verifying the input.public JComponentInputVerifier(String aMessage, IValidator aValidator)
aMessage
- the message to use when validation fails;aValidator
- the validator to use for verifying the input.public static JComponentInputVerifier create(Class<?> aType)
aType
- the type to create an input verifier for, cannot be
null
.null
.public static JComponentInputVerifier create(Class<?> aType, String aMessage)
aType
- the type to create an input verifier for, cannot be
null
;aMessage
- the message to display in case the verification failed.null
.public final void keyPressed(KeyEvent aEvent)
keyPressed
in interface KeyListener
KeyListener.keyPressed(java.awt.event.KeyEvent)
public final void keyReleased(KeyEvent aEvent)
keyReleased
in interface KeyListener
KeyListener.keyReleased(java.awt.event.KeyEvent)
public final void keyTyped(KeyEvent aEvent)
keyTyped
in interface KeyListener
KeyListener.keyTyped(java.awt.event.KeyEvent)
public final boolean verify(JComponent aInput)
verify
in class InputVerifier
InputVerifier.verify(javax.swing.JComponent)
protected Object getInputValue(Component aComponent)
aComponent
- the (Swing) component to get the value of, can be
null
.null
if this value is
unknown.protected String getMessage()
null
.Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.