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. When the close button of the MessagePane window title bar is hit, System.exit(0) is executed that terminates the JVM, but you can modifiy this behavior by registering your own implementation of the ExitListener interface or by using the key MessagePaneClosingMode in aplu_util.properties. For more details consult aplu_util.properties file found in the distribution.

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 that implements Cleanable.clean() that will be called when the title bar's close button is hit.
 void addExitListener(ExitListener listener)
          Register a class that implements ExitListener.notifyExit() that will be called when the title bar's close button is hit.
 javax.swing.JDialog getDialog()
          Return the dialog.
 boolean isDisposed()
          If in aplu_util.properties the MessagePaneClosingMode key is set to DisposeOnClose, the dialog is disposed when the close title button is clicked and this method returns true
 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 that implements Cleanable.clean() that will be called when the title bar's close button is hit. (Deprecated, use addExitListener())


addExitListener

public void addExitListener(ExitListener listener)
Register a class that implements ExitListener.notifyExit() that will be called when the title bar's close button is hit. Replacement of addCleanable().


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.

isDisposed

public boolean isDisposed()
If in aplu_util.properties the MessagePaneClosingMode key is set to DisposeOnClose, the dialog is disposed when the close title button is clicked and this method returns true