public class ASTMsg
extends java.lang.Object
These methods are static so that a class instance does not have to be created prior to usage. These methods simplify translating the code to other languages, and they help enforce consistency in usage and style.
These message methods display a message in a dialog box that is centered
relative to a parent frame that was set by the setParentFrame(JFrame)
method. The methods in this class also allow a calling routine to explicitly define a
parent frame on which to center the message dialog boxes.
Copyright (c) 2018
Constructor and Description |
---|
ASTMsg() |
Modifier and Type | Method and Description |
---|---|
static boolean |
abortMsg(java.lang.String msg)
Asks the user if they wish to abort, and centers the dialog on the
frame passed in
This method is overloaded.
|
static boolean |
abortMsg(java.lang.String msg,
javax.swing.JFrame frame)
Asks the user if they wish to abort, and centers the dialog on the
frame passed in
This method is overloaded.
|
static void |
criticalErrMsg(java.lang.String msg)
Display a critical error message centered on parentFrame
This method is overloaded.
|
static void |
criticalErrMsg(java.lang.String msg,
boolean abort)
Display a critical error message centered on parentFrame
This method is overloaded.
|
static void |
errMsg(java.lang.String msg,
java.lang.String title)
Conditionally displays an error message, but only if errFlag is SHOW_ERRORS.
|
static void |
errMsg(java.lang.String msg,
java.lang.String title,
boolean flag)
Conditionally displays an error message, but only if errFlag is SHOW_ERRORS.
|
static void |
errMsg(java.lang.String msg,
java.lang.String title,
javax.swing.JFrame frame)
Conditionally displays an error message, but only if errFlag is SHOW_ERRORS.
|
static void |
errMsg(java.lang.String msg,
java.lang.String title,
javax.swing.JPanel panel)
Conditionally displays an error message, but only if errFlag is SHOW_ERRORS.
|
static void |
infoMsg(java.lang.String msg)
Display a simple informational message.
|
static void |
infoMsg(java.lang.String msg,
java.lang.String title)
Display a simple informational message.
|
static boolean |
pleaseConfirm(java.lang.String msg,
java.lang.String title)
Asks the user to confirm something (such as whether to exit), and centers the dialog
on the frame passed in.
|
static boolean |
pleaseConfirm(java.lang.String msg,
java.lang.String title,
javax.swing.JFrame frame)
Asks the user to confirm something (such as whether to exit), and centers the dialog
on the frame passed in.
|
static void |
setParentFrame(javax.swing.JFrame parent)
Saves a reference to the caller's parent frame so error messages can be centered on the
parent application's window.
|
public static void setParentFrame(javax.swing.JFrame parent)
parent
- parent frame for the main applicationpublic static boolean abortMsg(java.lang.String msg, javax.swing.JFrame frame)
msg
- text message to display as a promptframe
- frame on which to center the message dialogpublic static boolean abortMsg(java.lang.String msg)
msg
- text message to display as a promptpublic static void criticalErrMsg(java.lang.String msg, boolean abort)
msg
- text of the message to displayabort
- whether to abort after message is displayed. Default is no.public static void criticalErrMsg(java.lang.String msg)
msg
- text of the message to displaypublic static void errMsg(java.lang.String msg, java.lang.String title, boolean flag)
msg
- text of the error message to be displayedtitle
- text for the dialog window's titleflag
- display error message only if flag is ASTMisc.SHOW_ERRORSpublic static void errMsg(java.lang.String msg, java.lang.String title)
msg
- text of the error message to be displayedtitle
- text for the dialog window's titlepublic static void errMsg(java.lang.String msg, java.lang.String title, javax.swing.JFrame frame)
msg
- text of the error message to be displayedtitle
- text for the dialog window's titleframe
- frame on which to center the message dialogpublic static void errMsg(java.lang.String msg, java.lang.String title, javax.swing.JPanel panel)
msg
- text of the error message to be displayedtitle
- text for the dialog window's titlepanel
- panel on which to center the message dialogpublic static void infoMsg(java.lang.String msg)
msg
- text message to displaypublic static void infoMsg(java.lang.String msg, java.lang.String title)
msg
- text message to displaytitle
- title for the message windowpublic static boolean pleaseConfirm(java.lang.String msg, java.lang.String title, javax.swing.JFrame frame)
msg
- text of the message to displaytitle
- text for the dialog window's titleframe
- frame on which to center the message dialog. If not given, use parentFramepublic static boolean pleaseConfirm(java.lang.String msg, java.lang.String title)
msg
- text of the message to displaytitle
- text for the dialog window's title