ch.aplu.util
Class MessagePane

java.lang.Object
  extended by ch.aplu.util.MessagePane

public class MessagePane
extends java.lang.Object

Modeless dialog containing one line of text. If no cleanable is registered, the the program terminates by clicking the title bar's close button (System.exit(0) will be called). If a cleanable is registered, its clean-method will be called when clicking the close button.

All Swing methods are invoked in the EDT.


Constructor Summary
MessagePane(int nbChars)
          Show a MessagePane at center of screen with given maximal number of characters to display.
MessagePane(int ulx, int uly, int nbChars)
          Show a MessagePane at given position (upper left corner) with maximal number of characters to display.
MessagePane(int ulx, int uly, java.lang.String text)
          Show a MessagePane at given position (upper left corner) containing given text.
MessagePane(int ulx, int uly, java.lang.String text, int millis)
          Construct a MessagePane at given position (upper left corner) containing given text and return after given amount of time (in milliseconds).
MessagePane(java.lang.String text)
          Show a MessagePane at center of screen containing the given text.
MessagePane(java.lang.String text, int millis)
          Construct a MessagePane at center of screen containing given text and return after given amount of time (in milliseconds).
 
Method Summary
 void addCleanable(Cleanable cl)
          Register a class with a method clean() that will be called when the title bar's close button is hit.
 javax.swing.JDialog getDialog()
          Return the dialog.
 void setText(java.lang.String text)
          Display the given text.
 void setText(java.lang.String text, int millis)
          Display the given text and return after the given amount of time (in milliseconds).
 void setVisible(boolean visible)
          Show/hide the dialog.
 void title(java.lang.String text)
          Display the given title.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagePane

public MessagePane(int ulx,
                   int uly,
                   int nbChars)
Show a MessagePane at given position (upper left corner) with maximal number of characters to display.


MessagePane

public MessagePane(int nbChars)
Show a MessagePane at center of screen with given maximal number of characters to display.


MessagePane

public MessagePane(int ulx,
                   int uly,
                   java.lang.String text)
Show a MessagePane at given position (upper left corner) containing given text. The size of the window is adapted to the length of the text.


MessagePane

public MessagePane(java.lang.String text)
Show a MessagePane at center of screen containing the given text. The size of the window is adapted to the length of the text.


MessagePane

public MessagePane(int ulx,
                   int uly,
                   java.lang.String text,
                   int millis)
Construct a MessagePane at given position (upper left corner) containing given text and return after given amount of time (in milliseconds). If millis < 0 the delay time is -millis, but setVisible(false) is called before returning. The size of the window is adapted to the length of the text.


MessagePane

public MessagePane(java.lang.String text,
                   int millis)
Construct a MessagePane at center of screen containing given text and return after given amount of time (in milliseconds). If millis < 0 the delay time is -millis, but setVisible(false) is called before returning. The size of the window is adapted to the length of the text.

Method Detail

addCleanable

public void addCleanable(Cleanable cl)
Register a class with a method clean() that will be called when the title bar's close button is hit.


setText

public void setText(java.lang.String text)
Display the given text. Swing methods are called from Event Dispatch Thread (EDT).


title

public void title(java.lang.String text)
Display the given title. Swing methods are called from Event Dispatch Thread (EDT).


setText

public void setText(java.lang.String text,
                    int millis)
Display the given text and return after the given amount of time (in milliseconds). If millis < 0 the delay time is -millis, but setVisible(false) is called before returning. The next invocation of setText() redisplays the MessagePane.


getDialog

public javax.swing.JDialog getDialog()
Return the dialog.


setVisible

public void setVisible(boolean visible)
Show/hide the dialog.

Parameters:
visible - if true, the dialog is shown, otherwise hidden.