public class DialogMessageLogger extends java.lang.Object implements MessageLogger
A class to write log and status messages to a scrolling text area in a dialog box.
Modifier and Type | Class and Description |
---|---|
protected class |
DialogMessageLogger.ClearActionListener |
protected class |
DialogMessageLogger.CreateGUIRunnable |
protected class |
DialogMessageLogger.SendRunnable |
protected class |
DialogMessageLogger.SetVisibleRunnable |
Modifier and Type | Field and Description |
---|---|
protected java.text.SimpleDateFormat |
dateFormatter |
protected javax.swing.JDialog |
outputDialog |
protected javax.swing.JScrollPane |
outputScrollPane |
protected javax.swing.JTextArea |
outputTextArea |
protected boolean |
showDateTime |
protected static long |
startTimeForLogging |
Constructor and Description |
---|
DialogMessageLogger(java.lang.String titleMessage,
int width,
int height,
boolean exitApplicationOnClose)
Construct a logger and make it immediately visible.
|
DialogMessageLogger(java.lang.String titleMessage,
int width,
int height,
boolean exitApplicationOnClose,
boolean visible)
Construct a slf4jlogger.
|
DialogMessageLogger(java.lang.String titleMessage,
int width,
int height,
boolean exitApplicationOnClose,
boolean visible,
boolean showDateTime,
java.lang.String dateTimeFormat)
Construct a slf4jlogger.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createGUI(java.lang.String titleMessage,
int width,
int height,
boolean exitApplicationOnClose,
boolean visible,
boolean showDateTime,
java.lang.String dateTimeFormat)
Construct the GUI for a slf4jlogger.
|
void |
send(java.lang.String message)
Append the supplied text to the log.
|
void |
sendLn(java.lang.String message)
Append the supplied text to the log, followed by a new line.
|
void |
setDateTimeFormat(java.lang.String pattern)
Set the date format to use
|
void |
setVisible(boolean visible) |
void |
showDateTime(boolean showDateTime)
Whether or not to show a timestamp.
|
protected void |
timestamp() |
protected java.text.SimpleDateFormat dateFormatter
protected javax.swing.JDialog outputDialog
protected javax.swing.JScrollPane outputScrollPane
protected javax.swing.JTextArea outputTextArea
protected boolean showDateTime
protected static long startTimeForLogging
public DialogMessageLogger(java.lang.String titleMessage, int width, int height, boolean exitApplicationOnClose)
Construct a logger and make it immediately visible.
titleMessage
- for the title bar of the dialog boxwidth
- initial width of the resizeable dialog boxheight
- initial height of the resizeable dialog boxexitApplicationOnClose
- if true, when the dialog box is closed (X-d out), will exit the application with success statuspublic DialogMessageLogger(java.lang.String titleMessage, int width, int height, boolean exitApplicationOnClose, boolean visible)
Construct a slf4jlogger.
titleMessage
- for the title bar of the dialog boxwidth
- initial width of the resizeable dialog boxheight
- initial height of the resizeable dialog boxexitApplicationOnClose
- if true, when the dialog box is closed (X-d out), will exit the application with success statusvisible
- if true, will be made visible after constructionpublic DialogMessageLogger(java.lang.String titleMessage, int width, int height, boolean exitApplicationOnClose, boolean visible, boolean showDateTime, java.lang.String dateTimeFormat)
Construct a slf4jlogger.
titleMessage
- for the title bar of the dialog boxwidth
- initial width of the resizeable dialog boxheight
- initial height of the resizeable dialog boxexitApplicationOnClose
- if true, when the dialog box is closed (X-d out), will exit the application with success statusvisible
- if true, will be made visible after constructionshowDateTime
- if true, show a timestampdateTimeFormat
- a java.text.SimpleDateFormat patternprotected void createGUI(java.lang.String titleMessage, int width, int height, boolean exitApplicationOnClose, boolean visible, boolean showDateTime, java.lang.String dateTimeFormat)
Construct the GUI for a slf4jlogger.
titleMessage
- for the title bar of the dialog boxwidth
- initial width of the resizeable dialog boxheight
- initial height of the resizeable dialog boxexitApplicationOnClose
- if true, when the dialog box is closed (X-d out), will exit the application with success statusvisible
- if true, will be made visible after constructionshowDateTime
- if true, show a timestampdateTimeFormat
- a java.text.SimpleDateFormat patternpublic void send(java.lang.String message)
MessageLogger
Append the supplied text to the log.
send
in interface MessageLogger
message
- the (possibly multi-line) text to append to the logpublic void sendLn(java.lang.String message)
MessageLogger
Append the supplied text to the log, followed by a new line.
sendLn
in interface MessageLogger
message
- the (possibly multi-line) text to append to the logpublic void setDateTimeFormat(java.lang.String pattern)
Set the date format to use
If not set will use relative time in ms from start of application
pattern
- a java.text.SimpleDateFormat patternpublic void setVisible(boolean visible)
public void showDateTime(boolean showDateTime)
Whether or not to show a timestamp.
showDateTime
- if true, show a timestampprotected void timestamp()