|
ProgramixGenericLib v5.0.1 | |||||||||
| 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
com.programix.gui.text.FormatField
com.programix.gui.text.IntegerField
public class IntegerField
A kind of FormatField (which is a JTextField) that
only allows the input of integer values.
The default range allows for
all possible int values).
By default, the numbers are formatted using a comma for the
"thousands" separator, but this can be turned off (or back on) with
setUseComma(boolean).
| Nested Class Summary | |
|---|---|
static class |
IntegerField.RangePair
A pair of IntegerField's that are linked together to
specify a range. |
| Nested classes/interfaces inherited from class com.programix.gui.text.FormatField |
|---|
FormatField.ValueListener |
| Nested classes/interfaces inherited from class javax.swing.JTextField |
|---|
JTextField.AccessibleJTextField |
| Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
|---|
JTextComponent.AccessibleJTextComponent, 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.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class com.programix.gui.text.FormatField |
|---|
allowValueListenerNotification, emptyReplacement, lock, value, valueStr |
| 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 | |
|---|---|
IntegerField()
|
|
IntegerField(IntegerRange validRange)
|
|
IntegerField(IntegerRange validRange,
int initialValue)
|
|
IntegerField(IntegerRange validRange,
Integer initialValue)
|
|
IntegerField(IntegerRange validRange,
String initialValue)
|
|
IntegerField(IntegerRange validRange,
Value initialValue)
|
|
| Method Summary | |
|---|---|
protected Value |
approveValue(Value proposedValue)
Gives subclasses a chance to approved the proposed new value. |
BigDecimal |
getBigDecimal()
Returns the current value as an BigDecimal or null if the field is empty. |
int |
getInt()
Returns the current value as an int. |
Integer |
getInteger()
Returns the current value as an Integer or null if the field is empty. |
IntegerRange |
getValidRange()
Returns the current range of valid values. |
boolean |
isUseComma()
Returns true if commas are currently being used. |
void |
setUseComma(boolean useComma)
Sets the use of a comma as the thousands grouping character. |
void |
setValidRange(IntegerRange newRange)
Sets the allowable range of values. |
void |
setValidRangeEnd(int newEnd)
Changes the end of the valid range. |
void |
setValidRangeEnd(Integer newEnd)
Changes the end of the valid range. |
void |
setValidRangeEnd(String newEnd)
Changes the end of the valid range. |
void |
setValidRangeEnd(Value newEnd)
Changes the end of the valid range. |
void |
setValidRangeStart(int newStart)
Changes the start of the valid range. |
void |
setValidRangeStart(Integer newStart)
Changes the start of the valid range. |
void |
setValidRangeStart(String newStart)
Changes the start of the valid range. |
void |
setValidRangeStart(Value newStart)
Changes the start of the valid range. |
void |
setValue(int newValue)
Sets the value specified as an int. |
void |
setValue(Number newValue)
Sets the value specified as a Number (which is the superclass of Integer, BigDecimal, and more). |
void |
updateUI()
|
| Methods inherited from class com.programix.gui.text.FormatField |
|---|
addValueListener, appendFilter, getEmptyReplacement, getFilterChainDocument, getString, getValue, isEmpty, isNotEmpty, notifyValueListeners, parseCurrentText, removeValueListener, setEmptyReplacement, setEmptyReplacement, setText, setValue, setValue, signalWarning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IntegerField(IntegerRange validRange,
Value initialValue)
public IntegerField(IntegerRange validRange,
Integer initialValue)
public IntegerField(IntegerRange validRange,
int initialValue)
public IntegerField(IntegerRange validRange,
String initialValue)
public IntegerField(IntegerRange validRange)
public IntegerField()
| Method Detail |
|---|
protected Value approveValue(Value proposedValue)
FormatFieldThe original version of this method on FormatField simply returns the value unchanged.
approveValue in class FormatFieldpublic void updateUI()
updateUI in class JTextComponentpublic void setValue(int newValue)
public int getInt()
throws ValueException
getInteger().
ValueException - if the field is empty or otherwise can't
be interpreted as an int.public void setValue(Number newValue)
public Integer getInteger()
FormatField.isEmpty() returns true
then this method returns null.
public BigDecimal getBigDecimal()
FormatField.isEmpty() returns true
then this method returns null.
public void setValidRange(IntegerRange newRange)
IntegerRange.MIN_TO_MAX_INT
is used instead.
If the start of the range is open, then Integer.MIN_VALUE
is used instead.
If the end of the range is open, then Integer.MAX_VALUE
is used instead.
public IntegerRange getValidRange()
public void setValidRangeStart(Integer newStart)
public void setValidRangeStart(int newStart)
public void setValidRangeStart(String newStart)
public void setValidRangeStart(Value newStart)
public void setValidRangeEnd(Integer newEnd)
public void setValidRangeEnd(int newEnd)
public void setValidRangeEnd(String newEnd)
public void setValidRangeEnd(Value newEnd)
public void setUseComma(boolean useComma)
public boolean isUseComma()
|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||