summaryrefslogtreecommitdiff
path: root/NET/worlds/console/ChatDialog.java
blob: cf75c95ea08a43bcfce93c97f574454d31c3fba0 (plain) (blame)
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
/*     */ package NET.worlds.console;
/*     */ 
/*     */ import java.awt.Button;
/*     */ import java.awt.Choice;
/*     */ import java.awt.Event;
/*     */ import java.awt.Font;
/*     */ import java.awt.GridBagConstraints;
/*     */ import java.awt.GridBagLayout;
/*     */ import java.awt.Label;
/*     */ import java.awt.Panel;
/*     */ import java.awt.TextField;
/*     */ import java.awt.Window;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class ChatDialog
/*     */   extends PolledDialog
/*     */ {
/*     */   private static final long serialVersionUID = 2346715931784644393L;
/*  35 */   private Label fontsizeLabel = new Label(Console.message("Font-Size"));
/*  36 */   private Label linesLabel = new Label(Console.message("Chat-Lines"));
/*  37 */   private Label chatlengthLabel = new Label(Console.message("Chat-Buffer-Length"));
/*  38 */   private Button okButton = new Button(Console.message("OK"));
/*  39 */   private Button cancelButton = new Button(Console.message("Cancel"));
/*  40 */   private static Font font = new Font(Console.message("MenuFont"), 0, 12);
/*     */   
/*     */ 
/*     */ 
/*     */   private Choice fontsizeChoice;
/*     */   
/*     */ 
/*     */ 
/*     */   private Choice linesChoice;
/*     */   
/*     */ 
/*     */   private TextField chatlengthField;
/*     */   
/*     */ 
/*     */ 
/*     */   public ChatDialog(Window parent, DialogReceiver receiver, String title, int defSize, int defLines, int defLength)
/*     */   {
/*  57 */     super(parent, receiver, title, true);
/*     */     
/*     */ 
/*     */ 
/*  61 */     this.fontsizeChoice = new Choice();
/*  62 */     this.linesChoice = new Choice();
/*  63 */     this.chatlengthField = new TextField(defLength);
/*     */     
/*  65 */     for (int i = 0; i <= 16; i++)
/*     */     {
/*  67 */       this.fontsizeChoice.insert(i + 10 + "pt", i);
/*     */     }
/*  69 */     if ((defSize < 10) || (defSize > 16)) {
/*  70 */       this.fontsizeChoice.select(2);
/*     */     } else {
/*  72 */       this.fontsizeChoice.select(defSize - 10);
/*     */     }
/*     */     
/*  75 */     for (int i = 0; i < 24; i++)
/*     */     {
/*  77 */       this.linesChoice.insert(i + 6 + " lines", i);
/*     */     }
/*  79 */     if ((defLines < 6) || (defLines > 30)) {
/*  80 */       this.linesChoice.select(0);
/*     */     } else {
/*  82 */       this.linesChoice.select(defLines - 6);
/*     */     }
/*     */     
/*  85 */     ready();
/*     */   }
/*     */   
/*     */   public int getFontsize()
/*     */   {
/*     */     try
/*     */     {
/*  92 */       return this.fontsizeChoice.getSelectedIndex() + 10;
/*     */     } catch (Exception e) {}
/*  94 */     return 12;
/*     */   }
/*     */   
/*     */ 
/*     */   public int getLines()
/*     */   {
/*     */     try
/*     */     {
/* 102 */       return this.linesChoice.getSelectedIndex() + 6;
/*     */     } catch (Exception e) {}
/* 104 */     return 6;
/*     */   }
/*     */   
/*     */   public int getLength()
/*     */   {
/*     */     try {
/* 110 */       return Integer.parseInt(this.chatlengthField.getText());
/*     */     } catch (Exception e) {}
/* 112 */     return 20000;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   protected void build()
/*     */   {
/* 119 */     GridBagLayout gbag = new GridBagLayout();
/* 120 */     setLayout(gbag);
/* 121 */     GridBagConstraints c = new GridBagConstraints();
/* 122 */     c.weightx = 1.0D;
/* 123 */     c.weighty = 1.0D;
/* 124 */     c.gridheight = 1;
/* 125 */     c.fill = 0;
/*     */     
/* 127 */     c.gridwidth = 2;
/* 128 */     this.fontsizeLabel.setFont(font);
/* 129 */     add(gbag, this.fontsizeLabel, c);
/* 130 */     c.gridwidth = 0;
/* 131 */     c.fill = 2;
/*     */     
/* 133 */     add(gbag, this.fontsizeChoice, c);
/*     */     
/* 135 */     c.fill = 0;
/* 136 */     c.gridwidth = 2;
/* 137 */     this.linesLabel.setFont(font);
/* 138 */     add(gbag, this.linesLabel, c);
/* 139 */     c.gridwidth = 0;
/* 140 */     c.fill = 2;
/*     */     
/* 142 */     add(gbag, this.linesChoice, c);
/*     */     
/* 144 */     c.gridwidth = 2;
/* 145 */     this.chatlengthLabel.setFont(font);
/* 146 */     add(gbag, this.chatlengthLabel, c);
/* 147 */     c.gridwidth = 0;
/* 148 */     c.fill = 2;
/* 149 */     this.chatlengthField.setFont(font);
/* 150 */     add(gbag, this.chatlengthField, c);
/*     */     
/* 152 */     Panel buttons = new Panel();
/* 153 */     buttons.add(this.okButton);
/* 154 */     buttons.add(this.cancelButton);
/* 155 */     this.okButton.setFont(font);
/* 156 */     this.cancelButton.setFont(font);
/* 157 */     c.gridwidth = 0;
/* 158 */     c.fill = 0;
/* 159 */     add(gbag, buttons, c);
/*     */   }
/*     */   
/*     */ 
/*     */   public void setVisible(boolean visible)
/*     */   {
/* 165 */     if (visible) {
/* 166 */       initialSize(320, 160);
/* 167 */       super.setVisible(visible);
/*     */       
/* 169 */       this.fontsizeChoice.requestFocus();
/*     */     } else {
/* 171 */       super.setVisible(visible);
/*     */     }
/*     */   }
/*     */   
/*     */   @Deprecated
/*     */   public boolean handleEvent(Event event) {
/* 177 */     if (event.id == 201)
/* 178 */       return done(false);
/* 179 */     return super.handleEvent(event);
/*     */   }
/*     */   
/*     */   @Deprecated
/*     */   public boolean action(Event event, Object what) {
/* 184 */     Object target = event.target;
/* 185 */     if (target == this.cancelButton) {
/* 186 */       done(false);
/* 187 */     } else if (target == this.okButton)
/* 188 */       done(true);
/* 189 */     return false;
/*     */   }
/*     */   
/*     */   @Deprecated
/*     */   public boolean keyDown(Event event, int key) {
/* 194 */     if (key == 27)
/* 195 */       return done(false);
/* 196 */     return super.keyDown(event, key);
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\ChatDialog.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */