Package be.gaudry.swing.utils.console
Class MessageConsole
java.lang.Object
be.gaudry.swing.utils.console.MessageConsole
Creates a simple console to display text messages. Has its messages displayed
in a different color.
Messages can either be appended to the console or inserted as the first line
of the console You can limit the number of lines to hold in the Document.
found on http://www.tips4java.wordpress.com
- Since:
- 1.0 Nov 25, 2009, 1.0
- Version:
- %I%, %G%
- Author:
- Steph GAUDRY
-
Nested Class Summary
Modifier and TypeClassDescription(package private) class
Class to intercept output from a PrintStream and add it to a Document. -
Field Summary
-
Constructor Summary
ConstructorDescriptionMessageConsole(JTextComponent textComponent)
MessageConsole(JTextComponent textComponent, boolean isAppend)
Use the text component specified as a simply console to display text messages. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clean()
Removes the textvoid
Redirect the output from the standard error to the console using the default text color and null PrintStreamvoid
redirectErr(Color textColor, PrintStream printStream)
Redirect the output from the standard error to the console using the specified color and PrintStream.void
Redirect the output from the standard output to the console using the default text color and null PrintStreamvoid
redirectOut(Color textColor, PrintStream printStream)
Redirect the output from the standard output to the console using the specified color and PrintStream.void
Reset the System.out and System.err outputs to defaultvoid
setMessageLines(int lines)
To prevent memory from being used up you can control the number of lines to display in the console This number can be dynamically changed, but the console will only be updated the next time the Document is updated.
-
Field Details
-
out
PrintStream out -
err
PrintStream err
-
-
Constructor Details
-
MessageConsole
-
MessageConsole
Use the text component specified as a simply console to display text messages. The messages can either be appended to the end of the console or inserted as the first line of the console.
-
-
Method Details
-
resetOutput
public void resetOutput()Reset the System.out and System.err outputs to default -
clean
public void clean()Removes the text -
redirectOut
public void redirectOut()Redirect the output from the standard output to the console using the default text color and null PrintStream -
redirectOut
Redirect the output from the standard output to the console using the specified color and PrintStream. When a PrintStream is specified the message will be added to the Document before it is also written to the PrintStream. -
redirectErr
public void redirectErr()Redirect the output from the standard error to the console using the default text color and null PrintStream -
redirectErr
Redirect the output from the standard error to the console using the specified color and PrintStream. When a PrintStream is specified the message will be added to the Document before it is also written to the PrintStream. -
setMessageLines
public void setMessageLines(int lines)To prevent memory from being used up you can control the number of lines to display in the console This number can be dynamically changed, but the console will only be updated the next time the Document is updated.
-