|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.text.JTextComponent javax.swing.JTextField acm.gui.DoubleField
public class DoubleField
This class implements a simple interactor that accepts a floating-point 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 | |
---|---|
DoubleField()
Creates a new field object for entering a double value. |
|
DoubleField(double value)
Creates a new field object for entering a double value. |
|
DoubleField(double low,
double high)
Creates a new field object for entering a double value,
which is constrained to be within the specified range. |
|
DoubleField(double value,
double low,
double high)
Creates a new field object for entering a double 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. |
double |
getValue()
Returns the value of this field as a double . |
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(double d)
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 DoubleField()
double
value.
The contents of the field are initially blank.
public DoubleField(double value)
double
value.
The contents of the field initially contain the specified value.
value
- The value to store in the fieldpublic DoubleField(double low, double high)
double
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 rangepublic DoubleField(double value, double low, double high)
double
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 rangeMethod 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 JTextField
public double getValue()
double
. 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.
double
public 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(double d)
d
- The value to be stored in the field
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |