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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
| import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.StringTokenizer;
public class Tabs extends Applet
{
public void init()
{
int i = 48;
String s = "TimesRoman";
String s2 = "24";
URL url = getDocumentBase();
String s5 = url.getHost();
url.getProtocol();
String s6 = url.getFile();
StringTokenizer stringtokenizer = new StringTokenizer(s6, "/");
String s7 = "";
if(stringtokenizer.hasMoreTokens())
s7 = stringtokenizer.nextToken();
String s8 = "";
if(stringtokenizer.hasMoreTokens())
s8 = stringtokenizer.nextToken();
String s9 = "";
if(stringtokenizer.hasMoreTokens())
s9 = stringtokenizer.nextToken();
if(s5.equals("localhost") || s5.equals("127.0.0.1") || s5.equals("intranet") || s5.equals("172.28.4.22") || s5.equals("172.28.4.140"))
{
xsize = size().width;
ysize = size().height;
backBuffer = createImage(xsize, ysize);
backGC = backBuffer.getGraphics();
String s10;
do
{
index++;
s10 = getParameter("tab" + index);
} while(s10 != null);
index--;
text = new String[index];
for(int j = 0; j < index; j++)
text[j] = getParameter("tab" + (j + 1));
String s11 = getParameter("font");
StringTokenizer stringtokenizer1 = new StringTokenizer(s11, ",");
String s1 = stringtokenizer1.nextToken();
String s4 = stringtokenizer1.nextToken();
String s3 = stringtokenizer1.nextToken();
byte byte0;
if(s4.equalsIgnoreCase("PLAIN"))
byte0 = 0;
else
if(s4.equalsIgnoreCase("BOLD"))
byte0 = 1;
else
if(s4.equalsIgnoreCase("ITALIC"))
byte0 = 2;
else
if(s4.equalsIgnoreCase("BOLD ITALIC"))
byte0 = 3;
else
byte0 = 0;
if(s3 != null)
i = Integer.parseInt(s3);
f = new Font(s1, byte0, i);
fm = backGC.getFontMetrics(f);
String s12 = getParameter("show");
if(s12 != null)
show = Integer.parseInt(s12) - 1;
String s13 = getParameter("tabwidth");
if(s13 != null)
w = Integer.parseInt(s13);
String s14 = getParameter("tabheight");
if(s14 != null)
h = Integer.parseInt(s14);
String s15 = getParameter("tabradius");
if(s15 != null)
r = Integer.parseInt(s15);
String s16 = getParameter("gap");
if(s16 != null)
gap = Integer.parseInt(s16);
String s17 = getParameter("xstart");
if(s17 != null)
x0 = Integer.parseInt(s17);
String s18 = getParameter("barheight");
if(s18 != null)
vh = Integer.parseInt(s18);
bgRGB = getParameter("bgcolor");
tabOn = new String[index];
tabOff = new String[index];
tabShow = new String[index];
textOn = new String[index];
textOff = new String[index];
textShow = new String[index];
u = new URL[index];
target = new String[index];
for(int k = 0; k < index; k++)
{
tabOn[k] = getParameter("tabon" + (k + 1));
tabOff[k] = getParameter("taboff" + (k + 1));
tabShow[k] = getParameter("tabshow" + (k + 1));
textOn[k] = getParameter("texton" + (k + 1));
textOff[k] = getParameter("textoff" + (k + 1));
textShow[k] = getParameter("textshow" + (k + 1));
try
{
u[k] = new URL(getParameter("URL" + String.valueOf(k + 1)));
}
catch(MalformedURLException _ex) { }
target[k] = getParameter("target" + String.valueOf(k + 1));
}
}
}
public void update(Graphics g)
{
paint(g);
}
public void paint(Graphics g)
{
if(bgRGB != null)
backGC.setColor(new Color(HexToInt(bgRGB.substring(0, 2)), HexToInt(bgRGB.substring(2, 4)), HexToInt(bgRGB.substring(4))));
else
backGC.setColor(Color.black);
backGC.fillRect(0, 0, xsize, ysize);
for(int i = 0; i < index; i++)
{
int j = x0 + i * (gap + w);
if(i == show)
backGC.setColor(new Color(HexToInt(tabShow[i].substring(0, 2)), HexToInt(tabShow[i].substring(2, 4)), HexToInt(tabShow[i].substring(4))));
else
if(i == on)
backGC.setColor(new Color(HexToInt(tabOn[i].substring(0, 2)), HexToInt(tabOn[i].substring(2, 4)), HexToInt(tabOn[i].substring(4))));
else
backGC.setColor(new Color(HexToInt(tabOff[i].substring(0, 2)), HexToInt(tabOff[i].substring(2, 4)), HexToInt(tabOff[i].substring(4))));
backGC.fillRoundRect(j, 0, w, h, 2 * r, 2 * r);
if(i == show)
backGC.setColor(new Color(HexToInt(tabShow[i].substring(0, 2)), HexToInt(tabShow[i].substring(2, 4)), HexToInt(tabShow[i].substring(4))));
else
if(i == on)
backGC.setColor(new Color(HexToInt(tabOn[i].substring(0, 2)), HexToInt(tabOn[i].substring(2, 4)), HexToInt(tabOn[i].substring(4))));
else
backGC.setColor(new Color(HexToInt(tabOff[i].substring(0, 2)), HexToInt(tabOff[i].substring(2, 4)), HexToInt(tabOff[i].substring(4))));
backGC.fillRect(j, h / 2, w, h / 2);
if(i == show)
backGC.setColor(new Color(HexToInt(textShow[i].substring(0, 2)), HexToInt(textShow[i].substring(2, 4)), HexToInt(textShow[i].substring(4))));
else
if(i == on)
backGC.setColor(new Color(HexToInt(textOn[i].substring(0, 2)), HexToInt(textOn[i].substring(2, 4)), HexToInt(textOn[i].substring(4))));
else
backGC.setColor(new Color(HexToInt(textOff[i].substring(0, 2)), HexToInt(textOff[i].substring(2, 4)), HexToInt(textOff[i].substring(4))));
backGC.setFont(f);
int k = (w - fm.stringWidth(text[i])) / 2;
int l = fm.getAscent() + (h - (fm.getAscent() + fm.getDescent())) / 2;
backGC.drawString(text[i], j + k, l);
if(i == show)
{
backGC.setColor(new Color(HexToInt(tabShow[i].substring(0, 2)), HexToInt(tabShow[i].substring(2, 4)), HexToInt(tabShow[i].substring(4))));
backGC.fillRect(0, h, xsize, vh);
}
}
g.drawImage(backBuffer, 0, 0, this);
}
public boolean mouseDown(Event event, int i, int j)
{
for(int k = 0; k < index; k++)
{
int l = x0 + k * (gap + w);
if(k != show && i >= l && i < l + w && j < h)
if(target[k] != null)
super.getAppletContext().showDocument(u[k], target[k]);
else
super.getAppletContext().showDocument(u[k]);
}
return true;
}
public boolean mouseMove(Event event, int i, int j)
{
for(int k = 0; k < index; k++)
{
int l = x0 + k * (gap + w);
if(k != show && i >= l && i < l + w && j < h)
{
on = k;
repaint();
}
}
return true;
}
public boolean mouseExit(Event event, int i, int j)
{
on = -1;
repaint();
return true;
}
public int HexToInt(String s)
{
int i = 0;
if(s.substring(0, 1).equalsIgnoreCase("a"))
i = 160;
else
if(s.substring(0, 1).equalsIgnoreCase("b"))
i = 176;
else
if(s.substring(0, 1).equalsIgnoreCase("c"))
i = 192;
else
if(s.substring(0, 1).equalsIgnoreCase("d"))
i = 208;
else
if(s.substring(0, 1).equalsIgnoreCase("e"))
i = 224;
else
if(s.substring(0, 1).equalsIgnoreCase("f"))
i = 240;
else
i = Integer.valueOf(s.substring(0, 1)).intValue() * 16;
if(s.substring(1).equalsIgnoreCase("a"))
i += 10;
else
if(s.substring(1).equalsIgnoreCase("b"))
i += 11;
else
if(s.substring(1).equalsIgnoreCase("c"))
i += 12;
else
if(s.substring(1).equalsIgnoreCase("d"))
i += 13;
else
if(s.substring(1).equalsIgnoreCase("e"))
i += 14;
else
if(s.substring(1).equalsIgnoreCase("f"))
i += 15;
else
i += Integer.valueOf(s.substring(1)).intValue();
return i;
}
public Tabs()
{
on = -1;
w = 100;
h = 30;
r = 15;
gap = 2;
x0 = 100;
vh = 10;
}
int xsize;
int ysize;
Image backBuffer;
Graphics backGC;
int index;
int on;
int show;
String text[];
Font f;
FontMetrics fm;
int w;
int h;
int r;
int gap;
int x0;
int vh;
String bgRGB;
String tabOn[];
String tabOff[];
String tabShow[];
String textOn[];
String textOff[];
String textShow[];
URL u[];
String target[];
} |