package NET.worlds.console; import NET.worlds.core.IniFile; import java.awt.GridBagConstraints; import java.awt.Label; import java.awt.TextField; import java.util.Properties; class ProxyServerDialog extends OkCancelDialog { private static final long serialVersionUID = 8421990344972629940L; private Label ipLabel = new Label("Proxy IP"); private TextField ipText = new TextField("", 15); private Label portLabel = new Label("Proxy Port"); private TextField portText = new TextField("", 3); public ProxyServerDialog() { super(Console.getFrame(), null, Console.message("Proxy-Server"), "Cancel", "Ok", "", false); this.ipText.setText(IniFile.gamma().getIniString("Proxy Server IP", "")); this.portText.setText(IniFile.gamma().getIniString("Proxy Server Port", "")); } @Override protected synchronized boolean done(boolean confirmed) { if (confirmed) { Properties p = System.getProperties(); IniFile.gamma().setIniString("Proxy Server IP", this.ipText.getText()); IniFile.gamma().setIniString("Proxy Server Port", this.portText.getText()); p.remove("socksProxyHost"); p.remove("socksProxyPort"); p.put("socksProxyHost", this.ipText.getText()); p.put("socksProxyPort", this.portText.getText()); System.setProperties(p); } return super.done(confirmed); } @Override public void build() { GridBagConstraints c = new GridBagConstraints(); c.gridx = 1; c.gridy = 1; c.weightx = 1.0; c.weighty = 1.0; this.add(this.gbag, this.ipLabel, c); c.gridy = 2; this.add(this.gbag, this.portLabel, c); c.gridx = 2; c.gridy = 1; c.weightx = 3.0; this.add(this.gbag, this.ipText, c); c.gridy = 2; this.add(this.gbag, this.portText, c); this.okButton.setFont(bfont); this.cancelButton.setFont(bfont); c.gridx = 1; c.gridy = 3; c.weightx = 1.0; this.add(this.gbag, this.okButton, c); c.gridx = 4; this.add(this.gbag, this.cancelButton, c); } }