|
|||||||||
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.
Field Summary |
---|
Constructor Summary | |
---|---|
DoubleField()
double value. |
|
DoubleField(double value)
double value. |
|
DoubleField(double low,
double high)
double value,
which is constrained to be within the specified range. |
|
DoubleField(double value,
double low,
double high)
double value,
which is constrained to be within the specified range. |
Method Summary | |
---|---|
boolean |
getExceptionOnError()
|
String |
getFormat()
null if no format has been set. |
double |
getValue()
double . |
void |
setExceptionOnError(boolean flag)
flag
parameter. |
void |
setFormat(String format)
|
void |
setValue(double d)
|
Constructor Detail |
---|
public DoubleField()
double
value.
The contents of the field are initially blank.
Usage: | DoubleField field = new DoubleField(); |
public DoubleField(double value)
double
value.
The contents of the field initially contain the specified value.
Usage: | DoubleField field = new DoubleField(value); | ||
Parameter: |
|
public DoubleField(double low,
double high)
double
value,
which is constrained to be within the specified range. The contents
of the field are initially blank.
Usage: | DoubleField field = new DoubleField(low, high); | ||||
Parameters: |
|
public 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.
Usage: | DoubleField field = new DoubleField(value, low, high); | ||||||
Parameters: |
|
Method Detail |
---|
public boolean getExceptionOnError()
Usage: | boolean flag = console.getExceptionOnError(); |
Returns: | The current setting of the error-handling mode (false to retry
on errors; true to raise an exception)
|
public String getFormat()
null
if no format has been set.
Usage: | String format = field.getFormat(); |
Returns: | The format for this field |
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.
Usage: | double d = field.getValue(); |
Returns: | The value stored in the field as a 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.
Usage: | field.setExceptionOnError(flag); | ||
Parameter: |
|
public void setFormat(String format)
Usage: | field.setFormat(format); | ||
Parameter: |
|
public void setValue(double d)
Usage: | field.setValue(d); | ||
Parameter: |
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |