public class ModelessOptionPane
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.net.URL |
ICON_EXCLAMATION
URL to display the exclamation icon.
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final java.net.URL ICON_EXCLAMATION
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)
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()