1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package info.rolandkrueger.roklib.util.formatter;
26
27 import java.awt.Color;
28
29 public class HTMLTextFormatter implements ITextFormatter
30 {
31 public CharSequence append (CharSequence text)
32 {
33 return text;
34 }
35
36 public CharSequence appendBold (CharSequence text)
37 {
38 return String.format ("<b>%s</b>", text);
39 }
40
41 public CharSequence appendColored (CharSequence text, Color color)
42 {
43
44 return String.format ("<font >%s</font>", text);
45 }
46
47 public CharSequence appendItalic (CharSequence text)
48 {
49 return String.format ("<i>%s</i>", text);
50 }
51
52 public CharSequence appendMonospaced (CharSequence text)
53 {
54 return String.format ("<pre>%s</pre>", text);
55 }
56
57 public CharSequence appendSubscript (CharSequence text)
58 {
59 return String.format ("<sub>%s</sub>", text);
60 }
61
62 public CharSequence appendSuperscript (CharSequence text)
63 {
64 return String.format ("<sup>%s</sup>", text);
65 }
66
67 public CharSequence appendUnderlined (CharSequence text)
68 {
69 return String.format ("<u>%s</u>", text);
70 }
71
72 public CharSequence appendStrikeThrough (CharSequence text)
73 {
74 return String.format ("<del>%s</del>", text);
75 }
76
77 public CharSequence encloseText (CharSequence text)
78 {
79 return String.format ("<html>%s</html>", text);
80 }
81 }