|
|||||||||
| 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
acm.gui.IntField
public class IntField
This class implements a simple interactor that accepts an integer value.
| 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.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 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 | |
|---|---|
IntField()
Creates a new field object for entering a int value. |
|
IntField(int value)
Creates a new field object for entering a int value. |
|
IntField(int low,
int high)
Creates a new field object for entering a int value,
which is constrained to be within the specified range. |
|
IntField(int value,
int low,
int high)
Creates a new field object for entering a int value,
which is constrained to be within the specified range. |
|
| Method Summary | |
|---|---|
boolean |
getExceptionOnError()
Returns the state of the error-handling flag. |
String |
getFormat()
Returns the format currently in use for this field, or null if no format has been set. |
Dimension |
getPreferredSize()
Overrides the standard definition to impose a target size. |
int |
getValue()
Returns the value of this field as a int. |
void |
setExceptionOnError(boolean flag)
Sets the error-handling mode of this interactor as specified by the flag
parameter. |
void |
setFormat(String format)
Sets the format used for the field. |
void |
setValue(int n)
Sets the value of a field. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IntField()
int value.
The contents of the field are initially blank.
public IntField(int value)
int value.
The contents of the field initially contain the specified value.
value - The value to store in the field
public IntField(int low,
int high)
int value,
which is constrained to be within the specified range. The contents
of the field are initially blank.
low - The lowest value in the permitted rangehigh - The highest value in the permitted range
public IntField(int value,
int low,
int high)
int value,
which is constrained to be within the specified range. The contents
of the field initially contain the specified value.
value - The value to store in the fieldlow - The lowest value in the permitted rangehigh - The highest value in the permitted range| Method Detail |
|---|
public boolean getExceptionOnError()
false to retry
on errors; true to raise an exception)public String getFormat()
null if no format has been set.
public Dimension getPreferredSize()
getPreferredSize in class JTextFieldpublic int getValue()
int. If this value is either
not a legal numeric value or is outside the specified range, this method will
either pop up a dialog allowing the user to reenter the value or throw an
ErrorException depending on the state of the exceptionOnError
flag.
intpublic void setExceptionOnError(boolean flag)
flag
parameter. If flag is false (which is the default),
calling getValue on this interactor displays
a dialog that gives the user a chance to retry after erroneous input. If this
value is set to true, illegal input raises an
ErrorException instead.
flag - false to retry on errors; true to raise an exceptionpublic void setFormat(String format)
format - The format to use for the fieldpublic void setValue(int n)
n - The value to be stored in the field
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||