/Users/lyon/j4p/src/gui/htmlconverter/JavaHtmlString.java
|
1 package gui.htmlconverter;
2
3
4 public class JavaHtmlString {
5
6 String pref;
7 String postf;
8
9 static String[] color = {
10 "Red", "\"#FF0000\"",
11 "Green", "\"#00FF00\"",
12 "Blue", "\"#0000FF\"",
13 "Yellow", "\"#FFFF00\"",
14 "Magenta", "\"#FF00FF\"",
15 "Cyan", "\"#00FFFF\"",
16 "Black", "\"#000000\"",
17 "White", "\"#FFFFFF\""
18 };
19
20 JavaHtmlString() {
21 pref = "";
22 postf = "";
23 }
24
25 void setColor(String c) {
26 int i;
27
28 for (i = 0; i < color.length; i += 2)
29 if (c.equals(color[i])) {
30 pref += "<FONT COLOR=" + color[i + 1] + ">";
31 postf += "</FONT>";
32 }
33 }
34
35 void setColorForMainText(String c) {
36 int i;
37
38 for (i = 0; i < color.length; i += 2)
39 if (c.equals(color[i])) {
40 pref += "<BODY TEXT=" + color[i + 1] + ">";
41 }
42 }
43
44
45 void setStyle(String s) {
46 if (s.equals("Bold"))
47 setBold();
48 else if (s.equals("Italic")) setItalic();
49 }
50
51 void setBold() {
52 pref += "<B>";
53 postf += "</B>";
54 return;
55 }
56
57 void setItalic() {
58 pref += "<I>";
59 postf += "</I>";
60 return;
61 }
62
63 }
64