views
Class MessageShower
java.lang.Object
views.MessageShower
- All Implemented Interfaces:
- java.lang.Runnable
public class MessageShower
- extends java.lang.Object
- implements java.lang.Runnable
The MessageShower
class relays messages and errors that occur to the
event dispatch thread. Because it's unsafe for other threads to
manipulate Swing components, this class should be run with the
SwingUtilities.invokeAndWait
method to display an error
dialog in the correct thread.
Constructor Summary |
MessageShower(java.awt.Component parentComponent,
java.lang.String error,
java.lang.String title,
int messageType,
boolean synchCall)
Constructs a new ErrorShower with the given message. |
MessageShower(java.lang.String error)
Constructs a new ErrorShower with the given error. |
Method Summary |
void |
run()
Displays the error in an error dialog. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
error
private java.lang.String error
messageType
private int messageType
title
private java.lang.String title
parentComponent
private java.awt.Component parentComponent
synchCall
boolean synchCall
MessageShower
public MessageShower(java.lang.String error)
- Constructs a new
ErrorShower
with the given error.
- Parameters:
error
- a String
MessageShower
public MessageShower(java.awt.Component parentComponent,
java.lang.String error,
java.lang.String title,
int messageType,
boolean synchCall)
- Constructs a new
ErrorShower
with the given message.
- Parameters:
error
- a String
messageType
- - Set the desired icon for the dialog. Use JOptionPane
messageType constants.synchCall
- - if true, no thread will be started, the caller has to wait until finished.
run
public void run()
- Displays the error in an error dialog. This method should not be
called directly, but should be called from within the
SwingUtilities.invokeAndWait
method.
- Specified by:
run
in interface java.lang.Runnable