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
|
/* */ package NET.worlds.console;
/* */
/* */ import java.awt.Color;
/* */ import java.awt.Dimension;
/* */ import java.awt.Font;
/* */ import java.awt.FontMetrics;
/* */ import java.awt.Graphics;
/* */ import java.awt.Toolkit;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class TextImageButtons
/* */ extends ImageButtons
/* */ {
/* */ private static final long serialVersionUID = -3744924750348174006L;
/* */ private int buttonCount;
/* */ private int[] xText;
/* */ private String[] texts;
/* */ private int[] buttonBottoms;
/* */ private Font font;
/* 60 */ private static Font defFont = new Font(Console.message("ButtonFont"),
/* 61 */ 0, 9);
/* */
/* */ private static final int yBaseline = 4;
/* */
/* */
/* */ public static Dimension measure(String text, Font f)
/* */ {
/* 68 */ Dimension sz = new Dimension();
/* 69 */ FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(f);
/* 70 */ sz.width = fm.stringWidth(text);
/* 71 */ sz.height = fm.getHeight();
/* 72 */ return sz;
/* */ }
/* */
/* */
/* */
/* */ public TextImageButtons(String imageName, int buttonWidth, int[] buttonHeights, int[] textLefts, String[] texts, ImageButtonsCallback handler)
/* */ {
/* 79 */ this(imageName, buttonWidth, buttonHeights, textLefts, texts, handler, defFont);
/* */ }
/* */
/* */
/* */ public TextImageButtons(String imageName, int buttonWidth, int[] buttonHeights, int[] textLefts, String[] texts, ImageButtonsCallback handler, Font f)
/* */ {
/* 85 */ super(imageName, buttonWidth, buttonHeights, handler);
/* 86 */ this.xText = textLefts;
/* 87 */ this.texts = texts;
/* 88 */ this.buttonCount = buttonHeights.length;
/* 89 */ this.font = f;
/* */
/* 91 */ this.buttonBottoms = new int[this.buttonCount];
/* 92 */ int lastBottom = 0;
/* 93 */ for (int i = 0; i < this.buttonCount; i++) {
/* 94 */ lastBottom += buttonHeights[i];
/* 95 */ this.buttonBottoms[i] = lastBottom;
/* */ }
/* */ }
/* */
/* */ public void setTexts(String[] newTexts) {
/* 100 */ assert (newTexts.length == this.texts.length);
/* 101 */ this.texts = newTexts;
/* 102 */ repaint();
/* */ }
/* */
/* */ public String getText(int i) {
/* 106 */ return this.texts[i];
/* */ }
/* */
/* */ protected Graphics drawButton(Graphics g, int button, int state)
/* */ {
/* 111 */ return drawButton(g, button, state, Color.white);
/* */ }
/* */
/* */ protected Graphics drawButton(Graphics g, int button, int state, Color c)
/* */ {
/* 116 */ if ((button >= 0) && (button < this.buttonCount) && (this.texts[button] != null)) {
/* 117 */ g = super.drawButton(g, button, state);
/* */
/* 119 */ if ((g != null) || ((g = getGraphics()) != null)) {
/* 120 */ g.setColor(c);
/* */
/* 122 */ g.setFont(this.font);
/* 123 */ g.drawString(this.texts[button], this.xText[button],
/* 124 */ this.buttonBottoms[button] - 4);
/* */ }
/* */ } else {
/* 127 */ g = super.drawButton(g, button, 0);
/* */ }
/* 129 */ return g;
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\TextImageButtons.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|