|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectbyucc.jhdl.util.gui.MessageBox
Provides a reusable window that presents a message and choice buttons to the user. A modal dialog is used. Since a thread is used to set the dialog to visible, when the client calls ask() it will not block. The client may implement ActionListener, which has: public void actionPerformed(ActionEvent evt) if user response notification is desired.
| Constructor Summary | |
MessageBox()
This constructor is used for no listener, such as for a simple okay dialog. |
|
MessageBox(java.awt.event.ActionListener listener)
This convenience constructor is used to delare the listener that will be notified when a button is clicked. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent evt)
|
void |
addChoice(java.lang.String label)
A convenience method that assumes the command is the same as the label. |
void |
addChoice(java.lang.String label,
java.lang.String command)
The @param label will be used for the button and the |
void |
ask(java.lang.String message)
One of the "ask" methods must be the last call when using a MessageBox. |
void |
askOkay(java.lang.String message)
Same as ask(String message) except adds an "Okay" button. |
void |
askYesNo(java.lang.String message)
Same as ask(String message) except adds "Yes" and "No" buttons. |
void |
keyPressed(java.awt.event.KeyEvent evt)
|
void |
keyReleased(java.awt.event.KeyEvent evt)
|
void |
keyTyped(java.awt.event.KeyEvent evt)
|
static void |
main(java.lang.String[] args)
|
void |
run()
This prevents the caller from blocking on ask(), which if this class is used on an awt event thread would cause a deadlock. |
void |
setActionListener(java.awt.event.ActionListener listener)
This set the listener to be notified of button clicks and WindowClosing events. |
void |
setCloseWindowCommand(java.lang.String command)
Sets the ActionCommand used in the ActionEvent when the user attempts to close the window. |
void |
setFrame(java.awt.Frame frame)
If a Frame is provided then it is used to instantiate the modal Dialog. |
void |
setTitle(java.lang.String title)
|
void |
useImageCanvas(java.awt.Canvas imageCanvas)
This is handy for providing a small image that will be displayed to the left of the message. |
void |
useImageCanvas(java.lang.String fileName)
This loads the image from the specified @param fileName, which must be in the same directory as this class. |
void |
windowActivated(java.awt.event.WindowEvent evt)
|
void |
windowClosed(java.awt.event.WindowEvent evt)
|
void |
windowClosing(java.awt.event.WindowEvent evt)
|
void |
windowDeactivated(java.awt.event.WindowEvent evt)
|
void |
windowDeiconified(java.awt.event.WindowEvent evt)
|
void |
windowIconified(java.awt.event.WindowEvent evt)
|
void |
windowOpened(java.awt.event.WindowEvent evt)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MessageBox(java.awt.event.ActionListener listener)
public MessageBox()
| Method Detail |
public static void main(java.lang.String[] args)
public void run()
run in interface java.lang.Runnablepublic void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed in interface java.awt.event.ActionListenerpublic void windowClosing(java.awt.event.WindowEvent evt)
windowClosing in interface java.awt.event.WindowListenerpublic void windowClosed(java.awt.event.WindowEvent evt)
windowClosed in interface java.awt.event.WindowListenerpublic void windowDeiconified(java.awt.event.WindowEvent evt)
windowDeiconified in interface java.awt.event.WindowListenerpublic void windowIconified(java.awt.event.WindowEvent evt)
windowIconified in interface java.awt.event.WindowListenerpublic void windowOpened(java.awt.event.WindowEvent evt)
windowOpened in interface java.awt.event.WindowListenerpublic void windowActivated(java.awt.event.WindowEvent evt)
windowActivated in interface java.awt.event.WindowListenerpublic void windowDeactivated(java.awt.event.WindowEvent evt)
windowDeactivated in interface java.awt.event.WindowListenerpublic void keyTyped(java.awt.event.KeyEvent evt)
keyTyped in interface java.awt.event.KeyListenerpublic void keyPressed(java.awt.event.KeyEvent evt)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent evt)
keyReleased in interface java.awt.event.KeyListenerpublic void setActionListener(java.awt.event.ActionListener listener)
public void setTitle(java.lang.String title)
public void setFrame(java.awt.Frame frame)
public void setCloseWindowCommand(java.lang.String command)
public void useImageCanvas(java.awt.Canvas imageCanvas)
public void useImageCanvas(java.lang.String fileName)
public void addChoice(java.lang.String label,
java.lang.String command)
command - will be returned to the listener.public void addChoice(java.lang.String label)
public void ask(java.lang.String message)
public void askOkay(java.lang.String message)
public void askYesNo(java.lang.String message)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||