|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--acm.io.IODialog
public class IODialog extends Object implements IOModel
The IODialog class provides a simple, dialog-based mechanism for interacting with the user. It is therefore similar to the JOptionPane facility in Swing (which it uses in the implementation). The differences between the models are
|
![]() |
Constructor Summary |
IODialog() |
IODialog(Component owner) |
Method Summary | |
boolean | getAllowCancel() |
boolean | getExceptionOnError() |
void | print(String value) |
void | println() |
void | println(String value) |
boolean | readBoolean() |
boolean | readBoolean(String prompt) |
boolean | readBoolean(String prompt,
String trueLabel,
String falseLabel) |
double | readDouble() |
double | readDouble(double low,
double high) |
double | readDouble(String prompt) |
double | readDouble(String prompt,
double low,
double high) |
int | readInt() |
int | readInt(int low,
int high) |
int | readInt(String prompt) |
int | readInt(String prompt,
int low,
int high) |
String | readLine() |
String | readLine(String prompt) |
void | setAllowCancel(boolean flag) |
void | setExceptionOnError(boolean flag) |
void | showErrorMessage(String msg) |
Constructor Detail |
public IODialog()
Usage: | dialog = new IODialog(); |
public IODialog(Component owner)
Usage: | dialog = new IODialog(owner); | ||
Parameter: |
|
Method Detail |
public boolean getAllowCancel()
Usage: | boolean flag = dialog.getAllowCancel(); |
Returns: | The current setting of the error-handling mode (false to retry on errors; true to raise an exception) |
public boolean getExceptionOnError()
Usage: | boolean flag = dialog.getExceptionOnError(); |
Returns: | The current setting of the error-handling mode (false to retry on errors; true to raise an exception) |
public void print(String value)
Usage: | dialog.print(value); | ||
Parameter: |
| ||
Specified by: | print in interface IOModel |
public void println()
Usage: | dialog.println(); |
Specified by: | println in interface IOModel |
public void println(String value)
Usage: | dialog.println(value); | ||
Parameter: |
| ||
Specified by: | println in interface IOModel |
public final boolean readBoolean()
Usage: | boolean flag = dialog.readBoolean(); |
Returns: | The value of the input interpreted as a boolean value |
Specified by: | readBoolean in interface IOModel |
public final boolean readBoolean(String prompt)
Usage: | boolean flag = dialog.readBoolean(prompt); | ||
Parameter: |
| ||
Returns: | The value of the input interpreted as a boolean value | ||
Specified by: | readBoolean in interface IOModel |
public boolean readBoolean(String prompt,
String trueLabel,
String falseLabel)
Usage: | boolean flag = dialog.readBoolean(prompt); | ||||||
Parameters: |
| ||||||
Returns: | The value of the input interpreted as a boolean value | ||||||
Specified by: | readBoolean in interface IOModel |
public final double readDouble()
Usage: | double d = dialog.readDouble(); |
Returns: | The value of the input interpreted as a double |
Specified by: | readDouble in interface IOModel |
public final double readDouble(double low,
double high)
Usage: | double d = dialog.readDouble(low, high); | ||||
Parameters: |
| ||||
Returns: | The value of the input interpreted as a double | ||||
Specified by: | readDouble in interface IOModel |
public final double readDouble(String prompt)
Usage: | double d = dialog.readDouble(prompt); | ||
Parameter: |
| ||
Returns: | The value of the input interpreted as a double | ||
Specified by: | readDouble in interface IOModel |
public double readDouble(String prompt,
double low,
double high)
Usage: | d = dialog.readDouble(prompt, low, high); | ||||||
Parameters: |
| ||||||
Returns: | The value of the input interpreted as a double | ||||||
Specified by: | readDouble in interface IOModel |
public final int readInt()
Usage: | int n = dialog.readInt(); |
Returns: | The value of the input interpreted as a decimal integer |
Specified by: | readInt in interface IOModel |
public final int readInt(int low,
int high)
Usage: | int n = dialog.readInt(low, high); | ||||
Parameters: |
| ||||
Returns: | The value of the input interpreted as a decimal integer | ||||
Specified by: | readInt in interface IOModel |
public final int readInt(String prompt)
Usage: | int n = dialog.readInt(prompt); | ||
Parameter: |
| ||
Returns: | The value of the input interpreted as a decimal integer | ||
Specified by: | readInt in interface IOModel |
public int readInt(String prompt,
int low,
int high)
Usage: | int n = dialog.readInt(prompt, low, high); | ||||||
Parameters: |
| ||||||
Returns: | The value of the input interpreted as a decimal integer | ||||||
Specified by: | readInt in interface IOModel |
public final String readLine()
Usage: | String str = dialog.readLine(); |
Returns: | The next line of input as a String |
Specified by: | readLine in interface IOModel |
public String readLine(String prompt)
Usage: | String str = dialog.readLine(prompt); | ||
Parameter: |
| ||
Returns: | The next line of input as a String | ||
Specified by: | readLine in interface IOModel |
public void setAllowCancel(boolean flag)
Usage: | dialog.setAllowCancel(flag); | ||
Parameter: |
|
public void setExceptionOnError(boolean flag)
Usage: | dialog.setExceptionOnError(flag); | ||
Parameter: |
|
public void showErrorMessage(String msg)
Usage: | dialog.showErrorMessage(msg); | ||
Parameter: |
| ||
Specified by: | showErrorMessage in interface IOModel |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |