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); } }