|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavabook.JavaBookDialog
javabook.ResponseBox
This dialog is for prompting a yes-no response from the user. This dialog allows the programmer to add a single line of prompt with two standard Yes and No buttons. Optionally, the dialog can be adjusted to have one, two, or three buttons with programmer-designated button labels. Buttons are identified by the constants BUTTON1, BUTTON2, and BUTTON3. For the standard two-button dialog, BUTTON1 and BUTTON2 can also be referred as YES and NO, respectively.
This class is provided as freeware. You are free to use as provided or modify to your heart's content. But you use it at your own risk. No implied or explicit warranty is given.
Field Summary | |
static int |
BUTTON1
The constant for the leftmost button whose value is equal to YES |
static int |
BUTTON2
The constant for the middle button whose value is equal to NO; this button is rightmost when the dialog has only two buttons |
static int |
BUTTON3
The constant for the rightmost button whose value is equal to CANCEL |
static int |
CANCEL
The constant for the CANCEL button |
static int |
NO
The constant for the NO button |
static int |
YES
The constant for the YES button |
Fields inherited from class javabook.JavaBookDialog |
ERROR_ICON, INFO_ICON, NO_ICON, QUESTION_ICON, WARNING_ICON |
Constructor Summary | |
ResponseBox(java.awt.Frame owner)
Constructs the standard ResponseBox dialog with two buttons labeled 'Yes' and 'No'. |
|
ResponseBox(java.awt.Frame owner,
int buttonCount)
Constructs this dialog with 'owner' as its owner and buttonCount number of buttons. |
Method Summary | |
int |
prompt(java.lang.String text)
Prompts the user and returns the result of user action. |
void |
setLabel(int id,
java.lang.String text)
Sets the label of the designated button identified by its id value. |
Methods inherited from class javabook.JavaBookDialog |
setIcon, setLocation, setTitle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int YES
public static final int NO
public static final int CANCEL
public static final int BUTTON1
public static final int BUTTON2
public static final int BUTTON3
Constructor Detail |
public ResponseBox(java.awt.Frame owner)
owner
- a Frame object owner of this dialogpublic ResponseBox(java.awt.Frame owner, int buttonCount)
owner
- a Frame object owner of this dialogbuttonCount
- the number of buttons this dialog hasMethod Detail |
public int prompt(java.lang.String text)
text
- the prompt message to display
public void setLabel(int id, java.lang.String text)
id
- the id of the buttontext
- the new label the button
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |