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
|
package NET.worlds.console;
import NET.worlds.core.IniFile;
import NET.worlds.network.Galaxy;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Event;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.Panel;
public class SetNumVisibleAvs extends PolledDialog {
private static final long serialVersionUID = -1189914406658113132L;
private Button okButton = new Button(Console.message("Apply-Vis"));
CheckboxGroup numAvsChoice = new CheckboxGroup();
CheckboxGroup fullAvsChoice = new CheckboxGroup();
private static Font font = new Font(Console.message("MenuFont"), 0, 12);
public SetNumVisibleAvs() {
super(Console.getFrame(), null, Console.message("Num-Visible"), true);
this.ready();
}
@Override
protected void build() {
this.setLayout(new BorderLayout());
this.add("North", new Filler(5, 5));
this.add("South", new Filler(10, 10));
this.add("East", new Filler(5, 5));
this.add("West", new Filler(5, 5));
Panel main = new Panel(new BorderLayout());
main.setFont(font);
main.add("North", new MultiLineLabel(Console.message("sel-max-av"), 5, 5));
Panel choices = new Panel(new GridLayout(10, 2));
int numAvs = IniFile.gamma().getIniInt("avatars", 24);
choices.add(new Label(""));
choices.add(new Label(Console.message("Max-Avs")));
choices.add(new Label(Console.message("Slower"), 1));
choices.add(new Checkbox("100", this.numAvsChoice, numAvs == 100));
choices.add(new Label(""));
choices.add(new Checkbox("80", this.numAvsChoice, numAvs == 80));
choices.add(new Label(""));
choices.add(new Checkbox("60", this.numAvsChoice, numAvs == 60));
choices.add(new Label(""));
choices.add(new Checkbox("40", this.numAvsChoice, numAvs == 40));
choices.add(new Label(""));
choices.add(new Checkbox("32", this.numAvsChoice, numAvs == 32));
choices.add(new Label(""));
choices.add(new Checkbox("24", this.numAvsChoice, numAvs == 24));
choices.add(new Label(""));
choices.add(new Checkbox("16", this.numAvsChoice, numAvs == 16));
choices.add(new Label(""));
choices.add(new Checkbox("8", this.numAvsChoice, numAvs == 8));
choices.add(new Label(Console.message("Faster"), 1));
choices.add(new Checkbox("4", this.numAvsChoice, numAvs == 4));
main.add("Center", choices);
main.add("South", this.okButton);
this.add("Center", main);
}
@Override
public boolean action(Event event, Object what) {
Object target = event.target;
if (target == this.okButton) {
this.done(true);
return true;
} else {
return false;
}
}
@Override
protected boolean done(boolean confirmed) {
if (confirmed) {
Checkbox c = this.numAvsChoice.getSelectedCheckbox();
if (c != null) {
try {
IniFile.gamma().setIniInt("avatars", Integer.parseInt(c.getLabel()));
} catch (NumberFormatException var5) {
}
}
c = this.fullAvsChoice.getSelectedCheckbox();
if (c != null) {
try {
String s = c.getLabel();
s = s.substring(0, s.length() - 1);
IniFile.gamma().setIniInt("fullavpercent", Integer.parseInt(s));
} catch (NumberFormatException var4) {
}
}
Galaxy.forceOffline(true);
}
return super.done(confirmed);
}
}
|