diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/ProxyServerDialog.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/console/ProxyServerDialog.java')
| -rw-r--r-- | NET/worlds/console/ProxyServerDialog.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/NET/worlds/console/ProxyServerDialog.java b/NET/worlds/console/ProxyServerDialog.java new file mode 100644 index 0000000..310a9a8 --- /dev/null +++ b/NET/worlds/console/ProxyServerDialog.java @@ -0,0 +1,63 @@ +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); + } +} |