Class RtfGenerator
java.lang.Object
org.fife.ui.rsyntaxtextarea.RtfGenerator
Generates RTF text via a simple Java API.
The following RTF features are supported:
- Fonts
- Font sizes
- Foreground and background colors
- Bold, italic, and underline
- It assumes that tokens changing foreground color often is fairly common.
- It assumes that background highlighting is fairly uncommon.
- Version:
- 1.1
- Author:
- Robert Futrell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a newline to the RTF document.voidappendToDoc(String text, Font f, Color fg, Color bg) Appends styled text to the RTF document being generated.voidappendToDoc(String text, Font f, Color fg, Color bg, boolean underline) Appends styled text to the RTF document being generated.voidappendToDoc(String text, Font f, Color fg, Color bg, boolean underline, boolean setFG) Appends styled text to the RTF document being generated.voidappendToDocNoFG(String text, Font f, Color bg, boolean underline) Appends styled text to the RTF document being generated.getRtf()Returns the RTF document created by this generator.voidreset()Resets this generator.
-
Constructor Details
-
RtfGenerator
Constructor.- Parameters:
mainBG- The main background color to use.
-
-
Method Details
-
appendNewline
public void appendNewline()Adds a newline to the RTF document.- See Also:
-
appendToDoc
Appends styled text to the RTF document being generated.- Parameters:
text- The text to append.f- The font of the text. If this isnull, the default font is used.fg- The foreground of the text. If this isnull, the default foreground color is used.bg- The background color of the text. If this isnull, the default background color is used.- See Also:
-
appendToDocNoFG
Appends styled text to the RTF document being generated.- Parameters:
text- The text to append.f- The font of the text. If this isnull, the default font is used.bg- The background color of the text. If this isnull, the default background color is used.underline- Whether the text should be underlined.- See Also:
-
appendToDoc
Appends styled text to the RTF document being generated.- Parameters:
text- The text to append.f- The font of the text. If this isnull, the default font is used.fg- The foreground of the text. If this isnull, the default foreground color is used.bg- The background color of the text. If this isnull, the default background color is used.underline- Whether the text should be underlined.- See Also:
-
appendToDoc
Appends styled text to the RTF document being generated.- Parameters:
text- The text to append.f- The font of the text. If this isnull, the default font is used.fg- The foreground of the text. If this isnull, the default foreground color is used.bg- The background color of the text. If this isnull, the default background color is used.underline- Whether the text should be underlined.setFG- Whether the foreground specified byfgshould be honored (if it is non-null).- See Also:
-
getRtf
Returns the RTF document created by this generator.- Returns:
- The RTF document, as a
String.
-
reset
public void reset()Resets this generator. All document information and content is cleared.
-