Package com.nomagic.text.rich
Class RichTextStringUtils
- java.lang.Object
-
- com.nomagic.text.rich.RichTextStringUtils
-
@OpenApiAll public class RichTextStringUtils extends java.lang.ObjectUtility class to work with rich text.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOLOR_POSTFIXColor tag postfixstatic java.lang.StringCOLOR_PREFIXColor tag prefixstatic java.awt.ColorGRAY_COLORGray color
-
Constructor Summary
Constructors Constructor Description RichTextStringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcloseColor(java.lang.String text)Close color tag.static voidcloseColor(java.lang.StringBuffer text)Close color tag.static voidcloseColor(java.lang.StringBuilder text)Close color tag.static voidstartColor(java.lang.StringBuffer text, java.awt.Color color)Set given color to the given text.static voidstartColor(java.lang.StringBuilder text, java.awt.Color color)Set given color to the given text.static java.lang.StringstartColor(java.lang.String text, java.awt.Color color)Set given color to the given text.static java.lang.StringtoString(java.awt.Color color)static java.lang.StringtrimText(java.lang.String text, int index)Trim text up to the given index.static voidwrapInColor(java.lang.StringBuffer text, java.awt.Color color)Set given color to the given text.static voidwrapInColor(java.lang.StringBuilder text, java.awt.Color color)Set given color to the given text.static java.lang.StringwrapInColor(java.lang.String text, java.awt.Color color)Set given color to the given text.
-
-
-
Field Detail
-
GRAY_COLOR
public static final java.awt.Color GRAY_COLOR
Gray color
-
COLOR_PREFIX
public static final java.lang.String COLOR_PREFIX
Color tag prefix- See Also:
- Constant Field Values
-
COLOR_POSTFIX
public static final java.lang.String COLOR_POSTFIX
Color tag postfix- See Also:
- Constant Field Values
-
-
Method Detail
-
closeColor
public static java.lang.String closeColor(java.lang.String text)
Close color tag.- Parameters:
text- text
-
closeColor
public static void closeColor(java.lang.StringBuilder text)
Close color tag.- Parameters:
text- text
-
closeColor
public static void closeColor(java.lang.StringBuffer text)
Close color tag.- Parameters:
text- text
-
startColor
public static void startColor(java.lang.StringBuffer text, java.awt.Color color)Set given color to the given text.- Parameters:
text- textcolor- color
-
startColor
public static void startColor(java.lang.StringBuilder text, java.awt.Color color)Set given color to the given text.- Parameters:
text- textcolor- color
-
startColor
public static java.lang.String startColor(java.lang.String text, java.awt.Color color)Set given color to the given text.- Parameters:
text- textcolor- color- Returns:
- text with given color
-
wrapInColor
public static java.lang.String wrapInColor(@CheckForNull java.lang.String text, java.awt.Color color)Set given color to the given text.- Parameters:
text- textcolor- color- Returns:
- text with given color
-
wrapInColor
public static void wrapInColor(java.lang.StringBuilder text, java.awt.Color color)Set given color to the given text.- Parameters:
text- textcolor- color
-
wrapInColor
public static void wrapInColor(java.lang.StringBuffer text, java.awt.Color color)Set given color to the given text.- Parameters:
text- textcolor- color
-
trimText
public static java.lang.String trimText(java.lang.String text, int index)Trim text up to the given index. Make sure that "color" tag is not cut.- Parameters:
text- textindex- index- Returns:
- cut text
-
toString
public static java.lang.String toString(java.awt.Color color)
- Parameters:
color- color- Returns:
- color representation
-
-