public class ASTPrt
extends java.lang.Object
This class implements methods that print to a scrollable text area that the invoking routine sets up. The methods are collected into a class to standardize behavior across the programs.
Copyright (c) 2018
Modifier and Type | Field and Description |
---|---|
static boolean |
CENTERTXT
Boolean indicating that text is to be centered in the print and println methods.
|
Constructor and Description |
---|
ASTPrt(javax.swing.JTextPane outTextPane)
Constructor saves a reference to the caller's output text area.
|
Modifier and Type | Method and Description |
---|---|
void |
clearTextArea()
Clears the caller's text output area
|
void |
print(java.lang.String txt)
Outputs text to the caller's scrollable output area and optionally centers it.
|
void |
print(java.lang.String txt,
boolean centerText)
Outputs text to the caller's scrollable output area and optionally centers it.
|
void |
println()
Outputs text and a newline to the caller's scrollable output area,
and optionally centers it
This method is overloaded.
|
void |
println(java.lang.String txt)
Outputs text and a newline to the caller's scrollable output area,
and optionally centers it
This method is overloaded.
|
void |
println(java.lang.String txt,
boolean centerText)
Outputs text and a newline to the caller's scrollable output area,
and optionally centers it
This method is overloaded.
|
void |
resetCursor()
Resets the cursor to the beginning of the scrollable text area.
|
void |
setBoldFont(boolean boldFont)
Sets whether the output font is to be bold or plain.
|
void |
setFixedWidthFont()
Sets the output font to be a fixed width font.
|
void |
setItalicFont(boolean italicFont)
Sets whether the output font is to be italicized.
|
void |
setProportionalFont()
Sets the output font to be a proportional font.
|
public static final boolean CENTERTXT
public ASTPrt(javax.swing.JTextPane outTextPane)
outTextPane
- JTextPane object created by calling routine for text outputpublic void clearTextArea()
public void resetCursor()
This method is intended to be used at the end of a lengthy series of prints so that the scrollable list presented to the user will be at the beginning of the list, not the end.
public void setBoldFont(boolean boldFont)
boldFont
- if true, set output font to be bold.public void setFixedWidthFont()
public void setItalicFont(boolean italicFont)
italicFont
- if true, set output font to be italicized.public void print(java.lang.String txt, boolean centerText)
txt
- text to outputcenterText
- center the text if this flag is CENTERTXT
public void print(java.lang.String txt)
txt
- text to outputpublic void println(java.lang.String txt, boolean centerText)
txt
- text to outputcenterText
- center the text if this flag is CENTERTXT
public void println(java.lang.String txt)
txt
- text to outputpublic void println()
public void setProportionalFont()