|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.util.ModelessOptionPane
public class ModelessOptionPane
Modeless message dialog using Swing JOptionPane.
Useful to show text and/or images while the application continues to run.
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 ModelessOptionPaneClosingMode in aplu_util.properties.
For more details consult aplu_util.properties file found in the distribution.
All Swing methods are invoked in the EDT.
Field Summary | |
---|---|
static java.net.URL |
ICON_EXCLAMATION
URL to display the exclamation icon. |
Constructor Summary | |
---|---|
ModelessOptionPane(java.awt.Frame owner,
int ulx,
int uly,
java.awt.Dimension size,
boolean isDecorated)
Same as general constructor, but with no text, no icon and no button, given dimension and selectable decoration. |
|
ModelessOptionPane(int ulx,
int uly,
java.lang.String text)
Same as general constructor, but with no icon and no button. |
|
ModelessOptionPane(int ulx,
int uly,
java.lang.String text,
java.net.URL iconUrl)
Same as ModelessOptionPane(ulx, uly, text, iconUrl, buttonText), but with no button. |
|
ModelessOptionPane(int ulx,
int uly,
java.lang.String text,
java.net.URL iconUrl,
java.lang.String buttonText)
General constructor that show a modeless message dialog at given position (upper left corner) containing given text and given icon image (gif or jpg). iconUrl is the URL for the icon resource. |
|
ModelessOptionPane(java.lang.String text)
Same as general constructor, but with no icon and no button and dialog centered in middle of screen. |
|
ModelessOptionPane(java.lang.String text,
java.net.URL iconUrl)
Same as general constructor, but with no button and dialog centered in middle of the screen. |
|
ModelessOptionPane(java.lang.String text,
java.net.URL iconUrl,
java.lang.String buttonText)
Same as general constructor, but dialog centered in middle of the screen. |
Method Summary | |
---|---|
void |
addActionListener(java.awt.event.ActionListener listener)
Register a ActionListener to get a notification when the button is hit. |
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. |
void |
dispose()
Dispose the dialog. |
javax.swing.JDialog |
getDialog()
Return the dialog. |
boolean |
isDisposed()
Return true, if in aplu_util.properties the ModelessOptionPaneClosingMode key is set to DisposeOnClose and the close button is clicked or after dispose() is called. |
boolean |
isVisible()
Return true, if dialog is visible; otherwise false. |
void |
requestFocus()
Request the focus. |
void |
setButtonEnabled(boolean enable)
Enable/disable the button (if any). |
void |
setText(java.lang.String text)
Display the given text. |
void |
setText(java.lang.String text,
boolean adjust)
Same as setText() but select whether to adjust size of dialog. |
void |
setTitle(java.lang.String title)
Same as showTitle(). |
void |
setVisible(boolean visible)
Show/hide the dialog. |
void |
showTitle(java.lang.String title)
Show the given title in the title bar. |
void |
toFront()
Bring the dialog to the front. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.net.URL ICON_EXCLAMATION
Constructor Detail |
---|
public ModelessOptionPane(int ulx, int uly, java.lang.String text, java.net.URL iconUrl, java.lang.String buttonText)
ClassLoader loader = getClass().getClassLoader();
URL iconUrl = loader.getResource(iconResource);
mop.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { // Code to execute when the button is hit } });
public ModelessOptionPane(int ulx, int uly, java.lang.String text, java.net.URL iconUrl)
public ModelessOptionPane(int ulx, int uly, java.lang.String text)
public ModelessOptionPane(java.awt.Frame owner, int ulx, int uly, java.awt.Dimension size, boolean isDecorated)
public ModelessOptionPane(java.lang.String text, java.net.URL iconUrl)
public ModelessOptionPane(java.lang.String text, java.net.URL iconUrl, java.lang.String buttonText)
public ModelessOptionPane(java.lang.String text)
Method Detail |
---|
public void addActionListener(java.awt.event.ActionListener listener)
public void setText(java.lang.String text)
public void setText(java.lang.String text, boolean adjust)
public void showTitle(java.lang.String title)
public void setTitle(java.lang.String title)
public void setButtonEnabled(boolean enable)
public void addCleanable(Cleanable cl)
public void addExitListener(ExitListener listener)
public void dispose()
public javax.swing.JDialog getDialog()
public void setVisible(boolean visible)
public boolean isVisible()
public void toFront()
public void requestFocus()
public boolean isDisposed()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |