|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
chrriis.dj.swingsuite.JTextEntryField
public class JTextEntryField
A text entry field, which supports validation, formatting and masks.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTextField |
---|
JTextField.AccessibleJTextField |
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
---|
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JTextField |
---|
notifyAction |
Fields inherited from class javax.swing.text.JTextComponent |
---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
protected |
JTextEntryField(int columns)
Construct a text entry field. |
protected |
JTextEntryField(int columns,
TextEntryMask textMask)
Construct a text entry field with a mask. |
|
JTextEntryField(String text)
Construct a text entry field. |
|
JTextEntryField(String text,
int columns)
Construct a text entry field. |
|
JTextEntryField(String text,
int columns,
int maxLength)
Construct a text entry field. |
|
JTextEntryField(String text,
int columns,
String pattern)
Construct a text entry field with input restricted by a pattern-based mask. |
|
JTextEntryField(String text,
int columns,
TextEntryMask mask)
Construct a text entry field. |
|
JTextEntryField(String text,
String mask)
Construct a text entry field. |
Method Summary | |
---|---|
void |
addTextEntryFieldListener(TextEntryFieldListener textEntryFieldListener)
Add a text entry listener. |
TextEntryFormatter |
getDisplayFormatter()
Get the formatter for the text when the component does not have the focus. |
int |
getMaximumLength()
Get the maximum length, or a negative value if there is no maximum. |
TextEntryFieldListener[] |
getTextEntryFieldListeners()
Get the text entry field listeners that are registered. |
TextEntryValidator |
getValidator()
Get the validator to use when data is to be validated. |
String |
getValidText()
Get a valid text, which is the current text if it is valid or the last valid one. |
boolean |
isFocusTrappedOnInvalidText()
Indicate wether the focus is trapped or if it can escape the field when the text is invalid. |
boolean |
isSelectingAllOnFocus()
Indicate whether this field selects all of its text when it acquires the focus. |
boolean |
isTipDisplayedOnError()
Indicate if the tip is displayed on error. |
void |
removeTextEntryFieldListener(TextEntryFieldListener textEntryFieldListener)
Remove a text entry field listener. |
protected void |
revalidateText()
Try to set a valid text in the field. |
void |
selectAll()
|
void |
setDocument(Document doc)
|
void |
setFocusTrappedOnInvalidText(boolean isFocusTrappedOnInvalidText)
Set whether the focus is trapped or if it can escape the field when the text is invalid. |
void |
setFormatter(TextEntryFormatter formatter)
Set the formatter for the text when the component does not have the focus. |
void |
setMaximumLength(int maximumLength)
Set the maximum text length. |
void |
setSelectAllOnFocus(boolean isSelectingAllOnFocus)
Set whether this field selects all of its text when it acquires the focus. |
void |
setText(String text)
Set some text, which only works when the text to set is valid. |
void |
setTipDisplayedOnError(boolean isTipDisplayedOnError)
Set if the tip is displayed on error. |
void |
setValidator(TextEntryValidator validator)
Set the text validator. |
void |
updateUI()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JTextEntryField(String text)
text
- the default text.public JTextEntryField(String text, int columns)
text
- the default text.columns
- The number of columns used to calculate the preferred width, or zero for the default size calculation.public JTextEntryField(String text, int columns, int maxLength)
text
- the default text.columns
- The number of columns used to calculate the preferred width, or zero for the default size calculation.maxLength
- the maximum length of the text.public JTextEntryField(String text, String mask)
text
- the default text.mask
- the mask to apply when entering the text.public JTextEntryField(String text, int columns, String pattern)
text
- the default text.columns
- The number of columns used to calculate the preferred width, or zero for the default size calculation.pattern
- the pattern of the mask to apply when entering the text.public JTextEntryField(String text, int columns, TextEntryMask mask)
text
- the default text.columns
- The number of columns used to calculate the preferred width, or zero for the default size calculation.mask
- the mask to apply when entering the text.protected JTextEntryField(int columns)
columns
- The number of columns used to calculate the preferred width, or zero for the default size calculation.protected JTextEntryField(int columns, TextEntryMask textMask)
columns
- The number of columns used to calculate the preferred width, or zero for the default size calculation.Method Detail |
---|
public void updateUI()
updateUI
in class JTextComponent
public void setFocusTrappedOnInvalidText(boolean isFocusTrappedOnInvalidText)
isFocusTrappedOnInvalidText
- true if the focus is trapped, false otherwise.public boolean isFocusTrappedOnInvalidText()
public void setDocument(Document doc)
setDocument
in class JTextField
public void setMaximumLength(int maximumLength)
maximumLength
- The maximum length, or a negative value if there is no limit.protected void revalidateText()
public int getMaximumLength()
public TextEntryValidator getValidator()
public void setValidator(TextEntryValidator validator)
validator
- The text validator, or null if there is no validation to perform.public void setFormatter(TextEntryFormatter formatter)
formatter
- The new formatter, or null to remove any formatting.public TextEntryFormatter getDisplayFormatter()
public void setTipDisplayedOnError(boolean isTipDisplayedOnError)
isTipDisplayedOnError
- indicate if the tip must be displayed on errorpublic boolean isTipDisplayedOnError()
public String getValidText()
public void setText(String text)
setText
in class JTextComponent
text
- The text to set.public void selectAll()
selectAll
in class JTextComponent
public void setSelectAllOnFocus(boolean isSelectingAllOnFocus)
isSelectingAllOnFocus
- true if the text should be selected when focus is acquired, false otherwise.public boolean isSelectingAllOnFocus()
public void addTextEntryFieldListener(TextEntryFieldListener textEntryFieldListener)
textEntryFieldListener
- the listener to add.public void removeTextEntryFieldListener(TextEntryFieldListener textEntryFieldListener)
textEntryFieldListener
- the listener to remove.public TextEntryFieldListener[] getTextEntryFieldListeners()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |