* Server list - Added pref configuration for server list URL. Server list will now be saved to client dir and used if configured URL is not reachable.

This commit is contained in:
LevelX2 2014-11-21 15:42:13 +01:00
parent 8ff5cedc22
commit 6d23ab616d
6 changed files with 575 additions and 437 deletions

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Config.xsd">
<server serverAddress="0.0.0.0" serverName="mage-server" port="17171" maxGameThreads="10" maxSecondsIdle="600"/>
<playerTypes>
<playerType name="Human" jar="mage-player-human.jar" className="mage.player.human.HumanPlayer"/>
<playerType name="Computer - minimax" jar="mage-player-aiminimax.jar" className="mage.player.ai.ComputerPlayer3"/>
<playerType name="Computer - mad" jar="mage-player-ai-ma.jar" className="mage.player.ai.ComputerPlayer6"/>
<playerType name="Computer - monte carlo" jar="mage-player-aimcts.jar" className="mage.player.ai.ComputerPlayerMCTS"/>
</playerTypes>
<gameTypes>
<gameType name="Two Player Duel" jar="mage-game-twoplayerduel.jar" className="mage.game.TwoPlayerMatch" typeName="mage.game.TwoPlayerDuelType"/>
<gameType name="Free For All" jar="mage-game-freeforall.jar" className="mage.game.FreeForAllMatch" typeName="mage.game.FreeForAllType"/>
</gameTypes>
<tournamentTypes>
<tournamentType name="Elimination Booster Draft" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftEliminationTournament" typeName="mage.tournament.BoosterDraftEliminationTournamentType"/>
<tournamentType name="Sealed Elimination" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedEliminationTournament" typeName="mage.tournament.SealedEliminationTournamentType"/>
</tournamentTypes>
<deckTypes>
<deckType name="Constructed - Standard" jar="mage-deck-constructed.jar" className="mage.deck.Standard"/>
<deckType name="Constructed - Extended" jar="mage-deck-constructed.jar" className="mage.deck.Extended"/>
<deckType name="Constructed - Modern" jar="mage-deck-constructed.jar" className="mage.deck.Modern"/>
<deckType name="Constructed - Vintage" jar="mage-deck-constructed.jar" className="mage.deck.Vintage"/>
<deckType name="Constructed - Legacy" jar="mage-deck-constructed.jar" className="mage.deck.Legacy"/>
<deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed.jar" className="mage.deck.InnistradBlock"/>
<deckType name="Block Constructed - Kamigawa" jar="mage-deck-constructed.jar" className="mage.deck.KamigawaBlock"/>
<deckType name="Block Constructed - Return to Ravnica" jar="mage-deck-constructed.jar" className="mage.deck.ReturnToRavnicaBlock"/>
<deckType name="Block Constructed - Scars of Mirrodin" jar="mage-deck-constructed.jar" className="mage.deck.ScarsOfMirrodinBlock"/>
<deckType name="Block Constructed - Shadowmoore" jar="mage-deck-constructed.jar" className="mage.deck.ShadowmooreBlock"/>
<deckType name="Block Constructed - Shards of Alara" jar="mage-deck-constructed.jar" className="mage.deck.ShardsOfAlaraBlock"/>
<deckType name="Block Constructed - Zendikar" jar="mage-deck-constructed.jar" className="mage.deck.ZendikarBlock"/>
<deckType name="Variant Magic - Commander" jar="mage-deck-constructed.jar" className="mage.deck.Commander"/>
<deckType name="Limited" jar="mage-deck-limited.jar" className="mage.deck.Limited"/>
</deckTypes>
</config>

View file

@ -0,0 +1,5 @@
woogerworks (Version 1.3.0 dev 2014-10-08V1) :xmage.woogerworks.com:17171
XMage.info 1 (Version 1.3.0 dev 2014-11-08v1) :176.31.186.181:17171
XMage.info 2 (Version 1.3.0 dev 2014-11-08V1) :176.31.186.181:17000
Seedds Server (Version 1.3.0 dev 2014-11-08v1) :115.29.203.80:17171
localhost -> connect to your local server (must be started):localhost:17171

View file

@ -43,13 +43,8 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtPort" alignment="0" min="-2" pref="71" max="-2" attributes="0"/>
<Component id="jProxySettingsButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="txtPort" alignment="0" min="-2" pref="71" max="-2" attributes="0"/>
<Component id="jProxySettingsButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">

View file

@ -45,10 +45,17 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.Writer;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -370,8 +377,9 @@ public class ConnectDialog extends MageDialog {
private void keyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_keyTyped
char c = evt.getKeyChar();
if (!Character.isDigit(c))
if (!Character.isDigit(c)) {
evt.consume();
}
}//GEN-LAST:event_keyTyped
private void chkAutoConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkAutoConnectActionPerformed
@ -382,11 +390,10 @@ public class ConnectDialog extends MageDialog {
private void findPublicServerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
BufferedReader in = null;
try {
// URL serverListURL = new URL("http://download.magefree.com/files/server-list.txt");
URL serverListURL = new URL("http://176.31.186.181/files/server-list.txt");
URL serverListURL = new URL(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONNECTION_URL_SERVER_LIST, "http://176.31.186.181/files/server-list.txt"));
Connection.ProxyType configProxyType = Connection.ProxyType.valueByText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_TYPE, "None"));
Proxy p = null;
Proxy.Type type = Proxy.Type.DIRECT;
switch (configProxyType) {
@ -417,16 +424,45 @@ public class ConnectDialog extends MageDialog {
return;
}
in = new BufferedReader(new InputStreamReader(serverListURL.openConnection(p).getInputStream()));
List<String> servers = new ArrayList<String>();
String inputLine;
while ((inputLine = in.readLine()) != null) {
logger.info("Found server: " + inputLine);
servers.add(inputLine);
boolean URLNotFound = false;
try {
in = new BufferedReader(new InputStreamReader(serverListURL.openConnection(p).getInputStream()));
} catch (FileNotFoundException| UnknownHostException ex ) {
logger.info("Could not read serverlist from: " + serverListURL.toString());
File f = new File("serverlist.txt");
if (f.exists() && !f.isDirectory()) {
logger.info("Using buffered serverlist: serverlist.txt");
URLNotFound = true;
in = new BufferedReader(new FileReader("serverlist.txt"));
}
}
List<String> servers = new ArrayList<>();
if (in != null) {
Writer output = null;
if (!URLNotFound) {
// write serverlist to be able to read if URL is not available
File file = new File("serverlist.txt");
if (file.exists() && !file.isDirectory()) {
file.delete();
}
output = new BufferedWriter(new FileWriter(file));
}
if (servers.size() == 0) {
String inputLine;
while ((inputLine = in.readLine()) != null) {
logger.info("Found server: " + inputLine);
servers.add(inputLine);
if (output != null) {
output.append(inputLine).append('\n');
}
}
if (output != null) {
output.close();
}
in.close();
}
if (servers.isEmpty()) {
JOptionPane.showMessageDialog(null, "Couldn't find any server.");
return;
}
@ -445,13 +481,14 @@ public class ConnectDialog extends MageDialog {
}
}
in.close();
} catch (Exception ex) {
logger.error(ex, ex);
} finally {
if (in != null) try {
in.close();
} catch (Exception e) {
if (in != null) {
try {
in.close();
} catch (Exception e) {
}
}
}
}//GEN-LAST:event_jButton1ActionPerformed

View file

@ -24,7 +24,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="tabsPanel" alignment="0" pref="566" max="32767" attributes="0"/>
<Component id="tabsPanel" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="saveButton" min="-2" max="-2" attributes="0"/>
@ -85,7 +85,7 @@
<Component id="main_game" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="main_gamelog" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="132" max="32767" attributes="0"/>
<EmptySpace pref="145" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -416,7 +416,7 @@
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="phases_stopSettings" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="18" max="32767" attributes="0"/>
<EmptySpace pref="31" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -1042,219 +1042,6 @@
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="tabConnection">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Connection">
<Property name="tabTitle" type="java.lang.String" value="Connection"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="lblProxyType" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="cbProxyType" min="-2" pref="126" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlProxySettings" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblProxyType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbProxyType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlProxySettings" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="163" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblProxyType">
<Properties>
<Property name="text" type="java.lang.String" value="Proxy:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbProxyType">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbProxyTypeActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ProxyType&gt;"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="pnlProxySettings">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
</AccessibilityProperties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlProxy" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="pnlProxy" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnlProxy">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
<Component id="rememberPswd" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblProxyPort" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyPassword" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyServer" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyUserName" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtProxyPort" alignment="0" min="-2" pref="58" max="-2" attributes="1"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="txtPasswordField" alignment="0" max="32767" attributes="1"/>
<Component id="txtProxyUserName" alignment="0" min="-2" pref="148" max="-2" attributes="1"/>
</Group>
<Component id="txtProxyServer" alignment="0" pref="398" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtProxyServer" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyServer" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblProxyPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtProxyPort" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtProxyUserName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyUserName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtPasswordField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyPassword" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="rememberPswd" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="25" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblProxyServer">
<Properties>
<Property name="text" type="java.lang.String" value="Server:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtProxyServer">
</Component>
<Component class="javax.swing.JLabel" name="lblProxyPort">
<Properties>
<Property name="text" type="java.lang.String" value="Port:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtProxyPort">
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtProxyPortkeyTyped"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lblProxyUserName">
<Properties>
<Property name="text" type="java.lang.String" value="User Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtProxyUserName">
</Component>
<Component class="javax.swing.JLabel" name="lblProxyPassword">
<Properties>
<Property name="text" type="java.lang.String" value="Password:"/>
</Properties>
</Component>
<Component class="javax.swing.JPasswordField" name="txtPasswordField">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtPasswordFieldActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="rememberPswd">
<Properties>
<Property name="text" type="java.lang.String" value="Remember Password"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rememberPswdActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="2"/>
</Property>
<Property name="text" type="java.lang.String" value="Note: password won&apos;t be encrypted!"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="tabAvatars">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
@ -1267,12 +1054,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="561" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="582" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="406" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="419" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -1683,6 +1470,300 @@
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="tabConnection">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Connection">
<Property name="tabTitle" type="java.lang.String" value="Connection"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="lblProxyType" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="cbProxyType" min="-2" pref="126" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="pnlProxySettings" alignment="0" max="32767" attributes="0"/>
<Component id="connection_servers" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="connection_servers" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblProxyType" min="-2" max="-2" attributes="0"/>
<Component id="cbProxyType" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="pnlProxySettings" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="92" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblProxyType">
<Properties>
<Property name="text" type="java.lang.String" value="Proxy:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbProxyType">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbProxyTypeActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ProxyType&gt;"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="pnlProxySettings">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
</AccessibilityProperties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlProxy" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="pnlProxy" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnlProxy">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="rememberPswd" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="47" max="-2" attributes="0"/>
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblProxyPort" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyPassword" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyServer" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyUserName" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtProxyPort" alignment="0" min="-2" pref="58" max="-2" attributes="1"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="txtPasswordField" alignment="0" max="32767" attributes="1"/>
<Component id="txtProxyUserName" alignment="0" min="-2" pref="148" max="-2" attributes="1"/>
</Group>
<Component id="txtProxyServer" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtProxyServer" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyServer" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblProxyPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtProxyPort" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtProxyUserName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyUserName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtPasswordField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblProxyPassword" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="rememberPswd" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="25" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblProxyServer">
<Properties>
<Property name="text" type="java.lang.String" value="Server:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtProxyServer">
</Component>
<Component class="javax.swing.JLabel" name="lblProxyPort">
<Properties>
<Property name="text" type="java.lang.String" value="Port:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtProxyPort">
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtProxyPortkeyTyped"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lblProxyUserName">
<Properties>
<Property name="text" type="java.lang.String" value="User Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtProxyUserName">
</Component>
<Component class="javax.swing.JLabel" name="lblProxyPassword">
<Properties>
<Property name="text" type="java.lang.String" value="Password:"/>
</Properties>
</Component>
<Component class="javax.swing.JPasswordField" name="txtPasswordField">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtPasswordFieldActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="rememberPswd">
<Properties>
<Property name="text" type="java.lang.String" value="Remember Password"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rememberPswdActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="2"/>
</Property>
<Property name="text" type="java.lang.String" value="Note: password won&apos;t be encrypted!"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="connection_servers">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Servers">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="lblURLServerList" min="-2" pref="96" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtURLServerList" min="-2" pref="421" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="141" max="-2" attributes="0"/>
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lblURLServerList" max="32767" attributes="0"/>
<Component id="txtURLServerList" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblURLServerList">
<Properties>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="URL server list:"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="horizontalTextPosition" type="int" value="10"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 16]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="1"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtURLServerList">
<Properties>
<Property name="toolTipText" type="java.lang.String" value="The URL XMage tries to read a server list from."/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[300, 22]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel17">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="2"/>
</Property>
<Property name="text" type="java.lang.String" value="e.g.: http://XMage.info/files/server-list.txt"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="saveButton">

View file

@ -207,6 +207,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_PROXY_REMEMBER = "proxyRemember";
public static final String KEY_PROXY_TYPE = "proxyType";
public static final String KEY_PROXY_PSWD = "proxyPassword";
public static final String KEY_CONNECTION_URL_SERVER_LIST = "connectionURLServerList";
public static final String KEY_AVATAR = "selectedId";
@ -379,21 +380,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
jLabel16 = new javax.swing.JLabel();
txtBattlefieldIBGMPath = new javax.swing.JTextField();
btnBattlefieldBGMBrowse = new javax.swing.JButton();
tabConnection = new javax.swing.JPanel();
lblProxyType = new javax.swing.JLabel();
cbProxyType = new javax.swing.JComboBox<ProxyType>();
pnlProxySettings = new javax.swing.JPanel();
pnlProxy = new javax.swing.JPanel();
lblProxyServer = new javax.swing.JLabel();
txtProxyServer = new javax.swing.JTextField();
lblProxyPort = new javax.swing.JLabel();
txtProxyPort = new javax.swing.JTextField();
lblProxyUserName = new javax.swing.JLabel();
txtProxyUserName = new javax.swing.JTextField();
lblProxyPassword = new javax.swing.JLabel();
txtPasswordField = new javax.swing.JPasswordField();
rememberPswd = new javax.swing.JCheckBox();
jLabel11 = new javax.swing.JLabel();
tabAvatars = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel9 = new javax.swing.JPanel();
@ -411,6 +397,25 @@ public class PreferencesDialog extends javax.swing.JDialog {
jPanel19 = new javax.swing.JPanel();
jPanel20 = new javax.swing.JPanel();
jPanel21 = new javax.swing.JPanel();
tabConnection = new javax.swing.JPanel();
lblProxyType = new javax.swing.JLabel();
cbProxyType = new javax.swing.JComboBox<ProxyType>();
pnlProxySettings = new javax.swing.JPanel();
pnlProxy = new javax.swing.JPanel();
lblProxyServer = new javax.swing.JLabel();
txtProxyServer = new javax.swing.JTextField();
lblProxyPort = new javax.swing.JLabel();
txtProxyPort = new javax.swing.JTextField();
lblProxyUserName = new javax.swing.JLabel();
txtProxyUserName = new javax.swing.JTextField();
lblProxyPassword = new javax.swing.JLabel();
txtPasswordField = new javax.swing.JPasswordField();
rememberPswd = new javax.swing.JCheckBox();
jLabel11 = new javax.swing.JLabel();
connection_servers = new javax.swing.JPanel();
lblURLServerList = new javax.swing.JLabel();
txtURLServerList = new javax.swing.JTextField();
jLabel17 = new javax.swing.JLabel();
saveButton = new javax.swing.JButton();
exitButton = new javax.swing.JButton();
@ -524,7 +529,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(132, Short.MAX_VALUE))
.addContainerGap(145, Short.MAX_VALUE))
);
main_card.getAccessibleContext().setAccessibleName("Game panel");
@ -707,7 +712,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addComponent(checkBoxEndTurnOthers))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(phases_stopSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(18, Short.MAX_VALUE))
.addContainerGap(31, Short.MAX_VALUE))
);
tabsPanel.addTab("Phases", tabPhases);
@ -1039,146 +1044,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabsPanel.addTab("Sounds", tabSounds);
lblProxyType.setText("Proxy:");
cbProxyType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbProxyTypeActionPerformed(evt);
}
});
pnlProxySettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
lblProxyServer.setText("Server:");
lblProxyPort.setText("Port:");
txtProxyPort.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtProxyPortkeyTyped(evt);
}
});
lblProxyUserName.setText("User Name:");
lblProxyPassword.setText("Password:");
txtPasswordField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPasswordFieldActionPerformed(evt);
}
});
rememberPswd.setText("Remember Password");
rememberPswd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rememberPswdActionPerformed(evt);
}
});
jLabel11.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N
jLabel11.setText("Note: password won't be encrypted!");
javax.swing.GroupLayout pnlProxyLayout = new javax.swing.GroupLayout(pnlProxy);
pnlProxy.setLayout(pnlProxyLayout);
pnlProxyLayout.setHorizontalGroup(
pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxyLayout.createSequentialGroup()
.addGap(29, 29, 29)
.addComponent(rememberPswd)
.addGap(18, 18, 18)
.addComponent(jLabel11)
.addGap(34, 34, 34))
.addGroup(pnlProxyLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblProxyPort)
.addComponent(lblProxyPassword)
.addComponent(lblProxyServer)
.addComponent(lblProxyUserName))
.addGap(19, 19, 19)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtProxyPort, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtPasswordField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtProxyUserName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtProxyServer, javax.swing.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE))
.addContainerGap())
);
pnlProxyLayout.setVerticalGroup(
pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxyLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtProxyServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblProxyServer))
.addGap(8, 8, 8)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblProxyPort)
.addComponent(txtProxyPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtProxyUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblProxyUserName))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblProxyPassword))
.addGap(18, 18, 18)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rememberPswd)
.addComponent(jLabel11))
.addContainerGap(25, Short.MAX_VALUE))
);
javax.swing.GroupLayout pnlProxySettingsLayout = new javax.swing.GroupLayout(pnlProxySettings);
pnlProxySettings.setLayout(pnlProxySettingsLayout);
pnlProxySettingsLayout.setHorizontalGroup(
pnlProxySettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxySettingsLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pnlProxy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pnlProxySettingsLayout.setVerticalGroup(
pnlProxySettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxySettingsLayout.createSequentialGroup()
.addComponent(pnlProxy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout tabConnectionLayout = new javax.swing.GroupLayout(tabConnection);
tabConnection.setLayout(tabConnectionLayout);
tabConnectionLayout.setHorizontalGroup(
tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabConnectionLayout.createSequentialGroup()
.addGroup(tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabConnectionLayout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(lblProxyType)
.addGap(18, 18, 18)
.addComponent(cbProxyType, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(tabConnectionLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pnlProxySettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
tabConnectionLayout.setVerticalGroup(
tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabConnectionLayout.createSequentialGroup()
.addContainerGap()
.addGroup(tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblProxyType)
.addComponent(cbProxyType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnlProxySettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(163, Short.MAX_VALUE))
);
pnlProxySettings.getAccessibleContext().setAccessibleDescription("");
tabsPanel.addTab("Connection", tabConnection);
jPanel10.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
@ -1417,15 +1282,199 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabAvatars.setLayout(tabAvatarsLayout);
tabAvatarsLayout.setHorizontalGroup(
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 561, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
);
tabAvatarsLayout.setVerticalGroup(
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 406, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)
);
tabsPanel.addTab("Avatars", tabAvatars);
lblProxyType.setText("Proxy:");
cbProxyType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbProxyTypeActionPerformed(evt);
}
});
pnlProxySettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
lblProxyServer.setText("Server:");
lblProxyPort.setText("Port:");
txtProxyPort.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtProxyPortkeyTyped(evt);
}
});
lblProxyUserName.setText("User Name:");
lblProxyPassword.setText("Password:");
txtPasswordField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPasswordFieldActionPerformed(evt);
}
});
rememberPswd.setText("Remember Password");
rememberPswd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rememberPswdActionPerformed(evt);
}
});
jLabel11.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N
jLabel11.setText("Note: password won't be encrypted!");
javax.swing.GroupLayout pnlProxyLayout = new javax.swing.GroupLayout(pnlProxy);
pnlProxy.setLayout(pnlProxyLayout);
pnlProxyLayout.setHorizontalGroup(
pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxyLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxyLayout.createSequentialGroup()
.addComponent(rememberPswd)
.addGap(47, 47, 47)
.addComponent(jLabel11)
.addGap(34, 34, 34))
.addGroup(pnlProxyLayout.createSequentialGroup()
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblProxyPort)
.addComponent(lblProxyPassword)
.addComponent(lblProxyServer)
.addComponent(lblProxyUserName))
.addGap(19, 19, 19)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtProxyPort, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtPasswordField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtProxyUserName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtProxyServer))
.addContainerGap())))
);
pnlProxyLayout.setVerticalGroup(
pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxyLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtProxyServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblProxyServer))
.addGap(8, 8, 8)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblProxyPort)
.addComponent(txtProxyPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtProxyUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblProxyUserName))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblProxyPassword))
.addGap(18, 18, 18)
.addGroup(pnlProxyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rememberPswd)
.addComponent(jLabel11))
.addContainerGap(25, Short.MAX_VALUE))
);
javax.swing.GroupLayout pnlProxySettingsLayout = new javax.swing.GroupLayout(pnlProxySettings);
pnlProxySettings.setLayout(pnlProxySettingsLayout);
pnlProxySettingsLayout.setHorizontalGroup(
pnlProxySettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxySettingsLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pnlProxy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pnlProxySettingsLayout.setVerticalGroup(
pnlProxySettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlProxySettingsLayout.createSequentialGroup()
.addComponent(pnlProxy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
connection_servers.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Servers"));
lblURLServerList.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
lblURLServerList.setText("URL server list:");
lblURLServerList.setToolTipText("");
lblURLServerList.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
lblURLServerList.setPreferredSize(new java.awt.Dimension(110, 16));
lblURLServerList.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
txtURLServerList.setToolTipText("The URL XMage tries to read a server list from.");
txtURLServerList.setPreferredSize(new java.awt.Dimension(300, 22));
jLabel17.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N
jLabel17.setText("e.g.: http://XMage.info/files/server-list.txt");
javax.swing.GroupLayout connection_serversLayout = new javax.swing.GroupLayout(connection_servers);
connection_servers.setLayout(connection_serversLayout);
connection_serversLayout.setHorizontalGroup(
connection_serversLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(connection_serversLayout.createSequentialGroup()
.addGroup(connection_serversLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(connection_serversLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblURLServerList, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtURLServerList, javax.swing.GroupLayout.PREFERRED_SIZE, 421, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(connection_serversLayout.createSequentialGroup()
.addGap(141, 141, 141)
.addComponent(jLabel17)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
connection_serversLayout.setVerticalGroup(
connection_serversLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(connection_serversLayout.createSequentialGroup()
.addGroup(connection_serversLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblURLServerList, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtURLServerList, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel17))
);
javax.swing.GroupLayout tabConnectionLayout = new javax.swing.GroupLayout(tabConnection);
tabConnection.setLayout(tabConnectionLayout);
tabConnectionLayout.setHorizontalGroup(
tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabConnectionLayout.createSequentialGroup()
.addContainerGap()
.addGroup(tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabConnectionLayout.createSequentialGroup()
.addComponent(lblProxyType)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cbProxyType, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(pnlProxySettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(connection_servers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
tabConnectionLayout.setVerticalGroup(
tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabConnectionLayout.createSequentialGroup()
.addContainerGap()
.addComponent(connection_servers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblProxyType)
.addComponent(cbProxyType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(pnlProxySettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(92, Short.MAX_VALUE))
);
pnlProxySettings.getAccessibleContext().setAccessibleDescription("");
tabsPanel.addTab("Connection", tabConnection);
saveButton.setLabel("Save");
saveButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
saveButton.addActionListener(new java.awt.event.ActionListener() {
@ -1446,7 +1495,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tabsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE)
.addComponent(tabsPanel)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(saveButton)
@ -1531,6 +1580,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
char[] input = txtPasswordField.getPassword();
prefs.put(KEY_PROXY_PSWD, new String(input));
}
save(prefs, dialog.txtURLServerList, KEY_CONNECTION_URL_SERVER_LIST);
// Avatar
if (available_avatars.contains(selectedAvatarId)) {
@ -1963,6 +2013,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
if (dialog.rememberPswd.isSelected()) {
load(prefs, dialog.txtPasswordField, KEY_PROXY_PSWD, "");
}
load(prefs, dialog.txtURLServerList, KEY_CONNECTION_URL_SERVER_LIST, "http://XMage.info/files/server-list.txt");
}
private static void loadSelectedAvatar(Preferences prefs) {
@ -2236,6 +2287,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox checkBoxMainYou;
private javax.swing.JCheckBox checkBoxUpkeepOthers;
private javax.swing.JCheckBox checkBoxUpkeepYou;
private javax.swing.JPanel connection_servers;
private javax.swing.JCheckBox displayBigCardsInHand;
private javax.swing.JButton exitButton;
private javax.swing.JLabel jLabel11;
@ -2244,6 +2296,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabelBeforeCombat;
private javax.swing.JLabel jLabelDraw;
private javax.swing.JLabel jLabelEndOfTurn;
@ -2274,6 +2327,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JLabel lblProxyServer;
private javax.swing.JLabel lblProxyType;
private javax.swing.JLabel lblProxyUserName;
private javax.swing.JLabel lblURLServerList;
private javax.swing.JPanel main_card;
private javax.swing.JPanel main_game;
private javax.swing.JPanel main_gamelog;
@ -2306,6 +2360,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JTextField txtProxyPort;
private javax.swing.JTextField txtProxyServer;
private javax.swing.JTextField txtProxyUserName;
private javax.swing.JTextField txtURLServerList;
// End of variables declaration//GEN-END:variables
private static final PreferencesDialog dialog = new PreferencesDialog(new javax.swing.JFrame(), true);