* Added user country flag. View of image in user list is still missing.
|
@ -92,6 +92,7 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.prefs.Preferences;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_CONNECT_FLAG;
|
||||
import mage.view.UserRequestMessage;
|
||||
import net.java.truevfs.access.TArchiveDetector;
|
||||
import net.java.truevfs.access.TConfig;
|
||||
|
@ -710,10 +711,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
ProxyType proxyType = ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||
String proxyUsername = prefs.get("proxyUsername", "");
|
||||
String proxyPassword = prefs.get("proxyPassword", "");
|
||||
int avatarId = PreferencesDialog.getSelectedAvatar();
|
||||
boolean showAbilityPickerForced = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true");
|
||||
|
||||
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
Connection connection = new Connection();
|
||||
|
@ -725,10 +722,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
connection.setProxyPort(proxyPort);
|
||||
connection.setProxyUsername(proxyUsername);
|
||||
connection.setProxyPassword(proxyPassword);
|
||||
connection.setAvatarId(avatarId);
|
||||
connection.setShowAbilityPickerForced(showAbilityPickerForced);
|
||||
connection.setAllowRequestShowHandCards(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"));
|
||||
connection.setUserSkipPrioritySteps(PreferencesDialog.getUserSkipPrioritySteps());
|
||||
|
||||
setUserPrefsToConnection(connection);
|
||||
|
||||
logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
||||
if (MageFrame.connect(connection)) {
|
||||
showGames(false);
|
||||
|
@ -742,6 +738,17 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void setUserPrefsToConnection(Connection connection) {
|
||||
int avatarId = PreferencesDialog.getSelectedAvatar();
|
||||
connection.setAvatarId(avatarId);
|
||||
boolean showAbilityPickerForced = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true");
|
||||
connection.setShowAbilityPickerForced(showAbilityPickerForced);
|
||||
connection.setAllowRequestShowHandCards(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"));
|
||||
connection.setConfirmEmptyManaPool(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"));
|
||||
connection.setUserSkipPrioritySteps(PreferencesDialog.getUserSkipPrioritySteps());
|
||||
connection.setFlagName(MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
|
|
|
@ -311,7 +311,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
|
||||
class TableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{"Players", "Info", "Games", "Connection"};
|
||||
private final String[] columnNames = new String[]{" ","Players", "Info", "Games", "Connection"};
|
||||
private UsersView[] players = new UsersView[0];
|
||||
|
||||
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
|
||||
|
@ -319,8 +319,9 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]);
|
||||
JTableHeader th = jTablePlayers.getTableHeader();
|
||||
TableColumnModel tcm = th.getColumnModel();
|
||||
tcm.getColumn(0).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(2).setHeaderValue(
|
||||
|
||||
tcm.getColumn(1).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(3).setHeaderValue(
|
||||
"Games " + roomUserInfo.getNumberActiveGames() +
|
||||
(roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads():" (") +
|
||||
" limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
|
@ -342,12 +343,14 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
public Object getValueAt(int arg0, int arg1) {
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
return players[arg0].getUserName();
|
||||
return players[arg0].getFlagName();
|
||||
case 1:
|
||||
return players[arg0].getInfoState();
|
||||
return players[arg0].getUserName();
|
||||
case 2:
|
||||
return players[arg0].getInfoGames();
|
||||
return players[arg0].getInfoState();
|
||||
case 3:
|
||||
return players[arg0].getInfoGames();
|
||||
case 4:
|
||||
return players[arg0].getInfoPing();
|
||||
}
|
||||
return "";
|
||||
|
|
|
@ -35,20 +35,19 @@
|
|||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="lblPort" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblServer" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblUserName" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="lblPort" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblServer" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblUserName" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lblFlag" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblStatus" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="chkForceUpdateDB" max="32767" attributes="0"/>
|
||||
<Component id="chkAutoConnect" pref="362" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jProxySettingsButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="164" pref="237" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jProxySettingsButton" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbFlag" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="txtServer" pref="286" max="32767" attributes="0"/>
|
||||
|
@ -57,8 +56,9 @@
|
|||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnFind" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="chkForceUpdateDB" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="chkAutoConnect" alignment="0" pref="358" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
@ -86,12 +86,17 @@
|
|||
<Component id="lblUserName" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="lblFlag" max="32767" attributes="0"/>
|
||||
<Component id="cbFlag" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="chkAutoConnect" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkForceUpdateDB" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jProxySettingsButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="20" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="50" max="32767" attributes="0"/>
|
||||
<Component id="lblStatus" min="-2" pref="24" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
|
@ -142,11 +147,24 @@
|
|||
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="txtUserName"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="User Name:"/>
|
||||
<Property name="text" type="java.lang.String" value="User name:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtUserName">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblFlag">
|
||||
<Properties>
|
||||
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="txtUserName"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="User flag:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.util.gui.countryBox.CountryComboBox" name="cbFlag">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkAutoConnect">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Automatically connect to this server next time"/>
|
||||
|
|
|
@ -37,7 +37,6 @@ package mage.client.dialog;
|
|||
import mage.client.MageFrame;
|
||||
import mage.client.util.Config;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -64,6 +63,9 @@ import java.util.concurrent.CancellationException;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_CONNECT_AUTO_CONNECT;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_CONNECT_FLAG;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -96,8 +98,18 @@ public class ConnectDialog extends MageDialog {
|
|||
this.txtServer.setText(MageFrame.getPreferences().get("serverAddress", Config.serverName));
|
||||
this.txtPort.setText(MageFrame.getPreferences().get("serverPort", Integer.toString(Config.port)));
|
||||
this.txtUserName.setText(MageFrame.getPreferences().get("userName", ""));
|
||||
this.chkAutoConnect.setSelected(Boolean.parseBoolean(MageFrame.getPreferences().get("autoConnect", "false")));
|
||||
this.chkAutoConnect.setSelected(Boolean.parseBoolean(MageFrame.getPreferences().get(KEY_CONNECT_AUTO_CONNECT, "false")));
|
||||
this.chkForceUpdateDB.setSelected(false); // has always to be set manually to force comparison
|
||||
|
||||
String selectedFlag = MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png");
|
||||
// set the selected country/flag
|
||||
for (int i = 0; i < cbFlag.getItemCount(); i++) {
|
||||
String[] name = (String[])cbFlag.getItemAt(i);
|
||||
if (name[1].equals(selectedFlag)) {
|
||||
cbFlag.setSelectedIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.setModal(true);
|
||||
this.setLocation(50, 50);
|
||||
this.setVisible(true);
|
||||
|
@ -107,7 +119,7 @@ public class ConnectDialog extends MageDialog {
|
|||
MageFrame.getPreferences().put("serverAddress", txtServer.getText().trim());
|
||||
MageFrame.getPreferences().put("serverPort", txtPort.getText().trim());
|
||||
MageFrame.getPreferences().put("userName", txtUserName.getText().trim());
|
||||
MageFrame.getPreferences().put("autoConnect", Boolean.toString(chkAutoConnect.isSelected()));
|
||||
MageFrame.getPreferences().put(KEY_CONNECT_AUTO_CONNECT, Boolean.toString(chkAutoConnect.isSelected()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,6 +139,8 @@ public class ConnectDialog extends MageDialog {
|
|||
txtPort = new javax.swing.JTextField();
|
||||
lblUserName = new javax.swing.JLabel();
|
||||
txtUserName = new javax.swing.JTextField();
|
||||
lblFlag = new javax.swing.JLabel();
|
||||
cbFlag = new mage.client.util.gui.countryBox.CountryComboBox();
|
||||
chkAutoConnect = new javax.swing.JCheckBox();
|
||||
chkForceUpdateDB = new javax.swing.JCheckBox();
|
||||
jProxySettingsButton = new javax.swing.JButton();
|
||||
|
@ -159,7 +173,12 @@ public class ConnectDialog extends MageDialog {
|
|||
});
|
||||
|
||||
lblUserName.setLabelFor(txtUserName);
|
||||
lblUserName.setText("User Name:");
|
||||
lblUserName.setText("User name:");
|
||||
|
||||
lblFlag.setLabelFor(txtUserName);
|
||||
lblFlag.setText("User flag:");
|
||||
|
||||
cbFlag.setEditable(true);
|
||||
|
||||
chkAutoConnect.setText("Automatically connect to this server next time");
|
||||
chkAutoConnect.setToolTipText("<HTML>If active this connect dialog will not be shown if you choose to connect.<br>\nInstead XMage tries to connect to the last server you were connected to.");
|
||||
|
@ -211,26 +230,26 @@ public class ConnectDialog extends MageDialog {
|
|||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPort)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(lblUserName))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPort)
|
||||
.addComponent(lblServer)
|
||||
.addComponent(lblUserName))
|
||||
.addComponent(lblFlag, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jProxySettingsButton)
|
||||
.addGap(164, 237, Short.MAX_VALUE))
|
||||
.addComponent(jProxySettingsButton)
|
||||
.addComponent(cbFlag, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(txtServer, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)
|
||||
.addComponent(txtPort, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(txtUserName))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnFind)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))))
|
||||
.addComponent(btnFind))
|
||||
.addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, 358, Short.MAX_VALUE))))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
|
@ -250,12 +269,16 @@ public class ConnectDialog extends MageDialog {
|
|||
.addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblUserName))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(lblFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(cbFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(5, 5, 5)
|
||||
.addComponent(chkAutoConnect)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkForceUpdateDB)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jProxySettingsButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE)
|
||||
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
|
@ -269,6 +292,7 @@ public class ConnectDialog extends MageDialog {
|
|||
|
||||
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
|
||||
MageFrame.getPreferences().put("autoConnect", Boolean.toString(chkAutoConnect.isSelected()));
|
||||
MageFrame.getPreferences().put(KEY_CONNECT_FLAG, (String)cbFlag.getSelectedItem());
|
||||
if (task != null && !task.isDone()) {
|
||||
task.cancel(true);
|
||||
} else {
|
||||
|
@ -304,7 +328,7 @@ public class ConnectDialog extends MageDialog {
|
|||
connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
|
||||
connection.setUsername(this.txtUserName.getText().trim());
|
||||
connection.setForceDBComparison(this.chkForceUpdateDB.isSelected());
|
||||
|
||||
MageFrame.getPreferences().put(KEY_CONNECT_FLAG, (String)cbFlag.getSelectedItem());
|
||||
|
||||
ProxyType configProxyType = Connection.ProxyType.valueByText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_TYPE, "None"));
|
||||
|
||||
|
@ -329,13 +353,8 @@ public class ConnectDialog extends MageDialog {
|
|||
}
|
||||
|
||||
// pref settings
|
||||
int avatarId = PreferencesDialog.getSelectedAvatar();
|
||||
connection.setAvatarId(avatarId);
|
||||
boolean showAbilityPickerForced = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true");
|
||||
connection.setAllowRequestShowHandCards(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"));
|
||||
connection.setShowAbilityPickerForced(showAbilityPickerForced);
|
||||
connection.setUserSkipPrioritySteps(PreferencesDialog.getUserSkipPrioritySteps());
|
||||
connection.setConfirmEmptyManaPool(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"));
|
||||
MageFrame.getInstance().setUserPrefsToConnection(connection);
|
||||
|
||||
logger.debug("connecting: " + connection.getProxyType() + " " + connection.getProxyHost() + " " + connection.getProxyPort());
|
||||
task = new ConnectTask();
|
||||
task.execute();
|
||||
|
@ -524,9 +543,11 @@ public class ConnectDialog extends MageDialog {
|
|||
private javax.swing.JButton btnCancel;
|
||||
private javax.swing.JButton btnConnect;
|
||||
private javax.swing.JButton btnFind;
|
||||
private mage.client.util.gui.countryBox.CountryComboBox cbFlag;
|
||||
private javax.swing.JCheckBox chkAutoConnect;
|
||||
private javax.swing.JCheckBox chkForceUpdateDB;
|
||||
private javax.swing.JButton jProxySettingsButton;
|
||||
private javax.swing.JLabel lblFlag;
|
||||
private javax.swing.JLabel lblPort;
|
||||
private javax.swing.JLabel lblServer;
|
||||
private javax.swing.JLabel lblStatus;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<Component id="exitButton" min="-2" pref="55" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="tabsPanel" alignment="0" pref="595" max="32767" attributes="0"/>
|
||||
<Component id="tabsPanel" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
|
|
@ -226,6 +226,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_CONNECTION_URL_SERVER_LIST = "connectionURLServerList";
|
||||
|
||||
public static final String KEY_AVATAR = "selectedId";
|
||||
|
||||
public static final String KEY_CONNECT_AUTO_CONNECT = "autoConnect";
|
||||
public static final String KEY_CONNECT_FLAG = "connectFlag";
|
||||
|
||||
|
||||
private static final Map<String, String> cache = new HashMap<>();
|
||||
|
||||
|
@ -1713,7 +1717,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
dialog.showAbilityPickerForced.isSelected(),
|
||||
dialog.cbAllowRequestToShowHandCards.isSelected(),
|
||||
dialog.cbConfirmEmptyManaPool.isSelected(),
|
||||
getUserSkipPrioritySteps());
|
||||
getUserSkipPrioritySteps(),
|
||||
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png"));
|
||||
|
||||
prefs.flush();
|
||||
} catch (BackingStoreException ex) {
|
||||
|
@ -2390,7 +2395,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true"),
|
||||
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"),
|
||||
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"),
|
||||
getUserSkipPrioritySteps());
|
||||
getUserSkipPrioritySteps(),
|
||||
MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world.png")
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,315 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
/**
|
||||
* A custom combo box with its own renderer and editor.
|
||||
* @author wwww.codejava.net
|
||||
*
|
||||
*/
|
||||
public class CountryComboBox extends JComboBox {
|
||||
|
||||
private final DefaultComboBoxModel model;
|
||||
|
||||
public static String[][] countryList = {
|
||||
{"Afghanistan", "af.png"},
|
||||
{"Åland Islands", "ax.png"},
|
||||
{"Albania", "al.png"},
|
||||
{"Algeria", "dz.png"},
|
||||
{"American Samoa", "as.png"},
|
||||
{"Andorra", "ad.png"},
|
||||
{"Angola", "an.png"},
|
||||
{"Anguilla", "ai.png"},
|
||||
{"Antarctica", "ao.png"},
|
||||
{"Antigua and Barbuda", "ag.png"},
|
||||
{"Argentina", "ar.png"},
|
||||
{"Armenia", "am.png"},
|
||||
{"Aruba", "aw.png"},
|
||||
{"Australia", "au.png"},
|
||||
{"Austria", "at.png"},
|
||||
{"Azerbaijan", "az.png"},
|
||||
{"Bahamas", "bs.png"},
|
||||
{"Bahrain", "bh.png"},
|
||||
{"Bangladesh", "bd.png"},
|
||||
{"Barbados", "bb.png"},
|
||||
{"Belarus", "by.png"},
|
||||
{"Belgium", "be.png"},
|
||||
{"Belize", "bz.png"},
|
||||
{"Benin", "bj.png"},
|
||||
{"Bermuda", "bm.png"},
|
||||
{"Bhutan", "bt.png"},
|
||||
{"Bolivia, Plurinational State of", "bo.png"},
|
||||
{"Bosnia and Herzegovina", "ba.png"},
|
||||
{"Botswana", "bw.png"},
|
||||
{"Bouvet Island", "bv.png"},
|
||||
{"Brazil", "br.png"},
|
||||
{"British Indian Ocean Territory", "io.png"},
|
||||
{"Brunei Darussalam", "bn.png"},
|
||||
{"Bulgaria", "bg.png"},
|
||||
{"Burkina Faso", "bf.png"},
|
||||
{"Burundi", "bi.png"},
|
||||
{"Cabo Verde", "cv.png"},
|
||||
{"Cambodia", "kh.png"},
|
||||
{"Cameroon", "cm.png"},
|
||||
{"Canada", "ca.png"},
|
||||
{"Catalonia", "catalonia.png"},
|
||||
{"Cayman Islands", "ky.png"},
|
||||
{"Central African Republic", "cf.png"},
|
||||
{"Chad", "td.png"},
|
||||
{"Chile", "cl.png"},
|
||||
{"China", "cn.png"},
|
||||
{"Christmas Island", "cx.png"},
|
||||
{"Cocos (Keeling) Islands", "cc.png"},
|
||||
{"Colombia", "co.png"},
|
||||
{"Comoros", "km.png"},
|
||||
{"Congo", "cg.png"},
|
||||
{"Congo, the Democratic Republic of the", "cd.png"},
|
||||
{"Cook Islands", "ck.png"},
|
||||
{"Costa Rica", "cr.png"},
|
||||
{"Côte d'Ivoire", "ci.png"},
|
||||
{"Croatia", "hr.png"},
|
||||
{"Cuba", "cu.png"},
|
||||
{"Cyprus", "cy.png"},
|
||||
{"Czech Republic", "cz.png"},
|
||||
{"Denmark", "dk.png"},
|
||||
{"Djibouti", "dj.png"},
|
||||
{"Dominica", "dm.png"},
|
||||
{"Dominican Republic", "do.png"},
|
||||
{"Ecuador", "ec.png"},
|
||||
{"Egypt", "eg.png"},
|
||||
{"El Salvador", "sv.png"},
|
||||
{"England", "england.png"},
|
||||
{"Equatorial Guinea", "gq.png"},
|
||||
{"Eritrea", "er.png"},
|
||||
{"Estonia", "ee.png"},
|
||||
{"Ethiopia", "et.png"},
|
||||
{"European Union", "europeanunion.png"},
|
||||
{"Falkland Islands (Malvinas)", "fk.png"},
|
||||
{"Faroe Islands", "fo.png"},
|
||||
{"Fiji", "fj.png"},
|
||||
{"Finland", "fi.png"},
|
||||
{"France", "fr.png"},
|
||||
{"French Guiana", "gf.png"},
|
||||
{"French Polynesia", "pf.png"},
|
||||
{"French Southern Territories", "tf.png"},
|
||||
{"Gabon", "ga.png"},
|
||||
{"Gambia", "gm.png"},
|
||||
{"Georgia", "ge.png"},
|
||||
{"Germany", "de.png"},
|
||||
{"Ghana", "gh.png"},
|
||||
{"Gibraltar", "gi.png"},
|
||||
{"Greece", "gr.png"},
|
||||
{"Greenland", "gl.png"},
|
||||
{"Grenada", "gd.png"},
|
||||
{"Guadeloupe", "gp.png"},
|
||||
{"Guam", "gu.png"},
|
||||
{"Guatemala", "gt.png"},
|
||||
{"Guinea", "gn.png"},
|
||||
{"Guinea-Bissau", "gw.png"},
|
||||
{"Guyana", "gy.png"},
|
||||
{"Haiti", "ht.png"},
|
||||
{"Heard Island and McDonald Islands", "hm.png"},
|
||||
{"Holy See", "va.png"},
|
||||
{"Honduras", "hn.png"},
|
||||
{"Hong Kong", "hk.png"},
|
||||
{"Hungary", "hu.png"},
|
||||
{"Iceland", "is.png"},
|
||||
{"India", "in.png"},
|
||||
{"Indonesia", "id.png"},
|
||||
{"Iran, Islamic Republic of", "ir.png"},
|
||||
{"Iraq", "iq.png"},
|
||||
{"Ireland", "ie.png"},
|
||||
{"Israel", "il.png"},
|
||||
{"Italy", "it.png"},
|
||||
{"Jamaica", "jm.png"},
|
||||
{"Japan", "jp.png"},
|
||||
{"Jordan", "jo.png"},
|
||||
{"Kazakhstan", "kz.png"},
|
||||
{"Kenya", "ke.png"},
|
||||
{"Kiribati", "ki.png"},
|
||||
{"Korea, Democratic People's Republic of", "kp.png"},
|
||||
{"Korea, Republic of", "kr.png"},
|
||||
{"Kuwait", "kw.png"},
|
||||
{"Kyrgyzstan", "kg.png"},
|
||||
{"Lao People's Democratic Republic", "la.png"},
|
||||
{"Latvia", "lv.png"},
|
||||
{"Lebanon", "lb.png"},
|
||||
{"Lesotho", "ls.png"},
|
||||
{"Liberia", "lr.png"},
|
||||
{"Libya", "ly.png"},
|
||||
{"Liechtenstein", "li.png"},
|
||||
{"Lithuania", "lt.png"},
|
||||
{"Luxembourg", "lu.png"},
|
||||
{"Macao", "mo.png"},
|
||||
{"Macedonia, the former Yugoslav Republic of", "mk.png"},
|
||||
{"Madagascar", "mg.png"},
|
||||
{"Malawi", "mw.png"},
|
||||
{"Malaysia", "my.png"},
|
||||
{"Maldives", "mv.png"},
|
||||
{"Mali", "ml.png"},
|
||||
{"Malta", "mt.png"},
|
||||
{"Marshall Islands", "mh.png"},
|
||||
{"Martinique", "mq.png"},
|
||||
{"Mauritania", "mr.png"},
|
||||
{"Mauritius", "mu.png"},
|
||||
{"Mayotte", "yt.png"},
|
||||
{"Mexico", "mx.png"},
|
||||
{"Micronesia, Federated States of", "fm.png"},
|
||||
{"Moldova, Republic of", "md.png"},
|
||||
{"Monaco", "mc.png"},
|
||||
{"Mongolia", "mn.png"},
|
||||
{"Montenegro", "me.png"},
|
||||
{"Montserrat", "ms.png"},
|
||||
{"Morocco", "ma.png"},
|
||||
{"Mozambique", "mz.png"},
|
||||
{"Myanmar", "mm.png"},
|
||||
{"Namibia", "na.png"},
|
||||
{"Nauru", "nr.png"},
|
||||
{"Nepal", "np.png"},
|
||||
{"Netherlands", "nl.png"},
|
||||
{"New Caledonia", "nc.png"},
|
||||
{"New Zealand", "nz.png"},
|
||||
{"Nicaragua", "ni.png"},
|
||||
{"Niger", "ne.png"},
|
||||
{"Nigeria", "ng.png"},
|
||||
{"Niue", "nu.png"},
|
||||
{"Norfolk Island", "nf.png"},
|
||||
{"Northern Mariana Islands", "mp.png"},
|
||||
{"Norway", "no.png"},
|
||||
{"Oman", "om.png"},
|
||||
{"Pakistan", "pk.png"},
|
||||
{"Palau", "pw.png"},
|
||||
{"Palestine, State of", "ps.png"},
|
||||
{"Panama", "pa.png"},
|
||||
{"Papua New Guinea", "pg.png"},
|
||||
{"Paraguay", "py.png"},
|
||||
{"Peru", "pe.png"},
|
||||
{"Philippines", "ph.png"},
|
||||
{"Pitcairn", "pn.png"},
|
||||
{"Poland", "pl.png"},
|
||||
{"Portugal", "pt.png"},
|
||||
{"Puerto Rico", "pr.png"},
|
||||
{"Qatar", "qa.png"},
|
||||
{"Réunion", "re.png"},
|
||||
{"Romania", "ro.png"},
|
||||
{"Russian Federation", "ru.png"},
|
||||
{"Rwanda", "rw.png"},
|
||||
{"Saint Helena, Ascension and Tristan da Cunha", "sh.png"},
|
||||
{"Saint Kitts and Nevis", "kn.png"},
|
||||
{"Saint Lucia", "lc.png"},
|
||||
{"Saint Pierre and Miquelon", "pm.png"},
|
||||
{"Saint Vincent and the Grenadines", "vc.png"},
|
||||
{"Samoa", "ws.png"},
|
||||
{"San Marino", "sm.png"},
|
||||
{"Sao Tome and Principe", "st.png"},
|
||||
{"Saudi Arabia", "sa.png"},
|
||||
{"Scotland", "scotland.png"},
|
||||
{"Senegal", "sn.png"},
|
||||
{"Serbia", "rs.png"},
|
||||
{"Seychelles", "sc.png"},
|
||||
{"Sierra Leone", "sl.png"},
|
||||
{"Singapore", "sg.png"},
|
||||
{"Slovakia", "sk.png"},
|
||||
{"Slovenia", "si.png"},
|
||||
{"Solomon Islands", "sb.png"},
|
||||
{"Somalia", "so.png"},
|
||||
{"South Africa", "za.png"},
|
||||
{"South Georgia and the South Sandwich Islands", "gs.png"},
|
||||
{"Spain", "es.png"},
|
||||
{"Sri Lanka", "lk.png"},
|
||||
{"Sudan", "sd.png"},
|
||||
{"Suriname", "sr.png"},
|
||||
{"Svalbard and Jan Mayen", "sj.png"},
|
||||
{"Swaziland", "sz.png"},
|
||||
{"Sweden", "se.png"},
|
||||
{"Switzerland", "ch.png"},
|
||||
{"Syrian Arab Republic", "sy.png"},
|
||||
{"Taiwan, Province of China", "tw.png"},
|
||||
{"Tajikistan", "tj.png"},
|
||||
{"Tanzania, United Republic of", "tz.png"},
|
||||
{"Thailand", "th.png"},
|
||||
{"Timor-Leste", "tl.png"},
|
||||
{"Togo", "tg.png"},
|
||||
{"Tokelau", "tk.png"},
|
||||
{"Tonga", "to.png"},
|
||||
{"Trinidad and Tobago", "tt.png"},
|
||||
{"Tunisia", "tn.png"},
|
||||
{"Turkey", "tr.png"},
|
||||
{"Turkmenistan", "tm.png"},
|
||||
{"Turks and Caicos Islands", "tc.png"},
|
||||
{"Tuvalu", "tv.png"},
|
||||
{"Uganda", "ug.png"},
|
||||
{"Ukraine", "ua.png"},
|
||||
{"United Arab Emirates", "ae.png"},
|
||||
{"United Kingdom of Great Britain and Northern Ireland", "gb.png"},
|
||||
{"United States Minor Outlying Islands", "um.png"},
|
||||
{"United States of America", "us.png"},
|
||||
{"Uruguay", "uy.png"},
|
||||
{"Uzbekistan", "uz.png"},
|
||||
{"Vanuatu", "vu.png"},
|
||||
{"Venezuela, Bolivarian Republic of", "ve.png"},
|
||||
{"Viet Nam", "vn.png"},
|
||||
{"Virgin Islands, British", "vg.png"},
|
||||
{"Virgin Islands, U.S.", "vi.png"},
|
||||
{"Wales", "wales.png"},
|
||||
{"Wallis and Futuna", "wf.png"},
|
||||
{"World", "world.png"},
|
||||
{"Western Sahara", "eh.png"},
|
||||
{"Yemen", "ye.png"},
|
||||
{"Zambia", "zm.png"},
|
||||
{"Zimbabwe", "zw.png"},
|
||||
};
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public CountryComboBox() {
|
||||
model = new DefaultComboBoxModel();
|
||||
setModel(model);
|
||||
setRenderer(new CountryItemRenderer());
|
||||
setEditor(new CountryItemEditor());
|
||||
addItems(countryList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an array items to this combo box.
|
||||
* Each item is an array of two String elements:
|
||||
* - first element is country name.
|
||||
* - second element is path of an image file for country flag.
|
||||
* @param items
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addItems(String[][] items) {
|
||||
for (String[] anItem : items) {
|
||||
model.addElement(anItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.plaf.basic.BasicComboBoxEditor;
|
||||
|
||||
|
||||
/**
|
||||
* Editor for JComboBox
|
||||
* @author wwww.codejava.net
|
||||
*
|
||||
*/
|
||||
public class CountryItemEditor extends BasicComboBoxEditor {
|
||||
private final JPanel panel = new JPanel();
|
||||
private final JLabel labelItem = new JLabel();
|
||||
private String selectedValue;
|
||||
|
||||
public CountryItemEditor() {
|
||||
panel.setLayout(new GridBagLayout());
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weightx = 1.0;
|
||||
constraints.insets = new Insets(2, 5, 2, 2);
|
||||
|
||||
labelItem.setOpaque(false);
|
||||
labelItem.setHorizontalAlignment(JLabel.LEFT);
|
||||
labelItem.setForeground(Color.WHITE);
|
||||
|
||||
panel.add(labelItem, constraints);
|
||||
panel.setBackground(new Color(0,104,139, 0));
|
||||
selectedValue = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getEditorComponent() {
|
||||
return this.panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem() {
|
||||
return this.selectedValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem(Object item) {
|
||||
if (item == null || !(item instanceof String[])) {
|
||||
return;
|
||||
}
|
||||
String[] countryItem = (String[]) item;
|
||||
selectedValue = countryItem[0];
|
||||
labelItem.setText(selectedValue);
|
||||
labelItem.setIcon(new ImageIcon(getClass().getResource("/flags/"+ countryItem[1])));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ListCellRenderer;
|
||||
|
||||
|
||||
/**
|
||||
* Customer renderer for JComboBox
|
||||
* @author www.codejava.net
|
||||
*
|
||||
*/
|
||||
|
||||
public class CountryItemRenderer extends JPanel implements ListCellRenderer {
|
||||
private final JLabel labelItem = new JLabel();
|
||||
|
||||
public CountryItemRenderer() {
|
||||
setLayout(new GridBagLayout());
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraints.weightx = 1.0;
|
||||
constraints.insets = new Insets(0, 0, 0, 0);
|
||||
|
||||
labelItem.setOpaque(true);
|
||||
labelItem.setHorizontalAlignment(JLabel.LEFT);
|
||||
|
||||
add(labelItem, constraints);
|
||||
setBackground(Color.LIGHT_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value,
|
||||
int index, boolean isSelected, boolean cellHasFocus) {
|
||||
String[] countryItem = (String[]) value;
|
||||
|
||||
// set country name
|
||||
labelItem.setText(countryItem[0]);
|
||||
|
||||
// set country flag
|
||||
labelItem.setIcon(new ImageIcon(countryItem[1]));
|
||||
|
||||
if (isSelected) {
|
||||
labelItem.setBackground(Color.BLUE);
|
||||
labelItem.setForeground(Color.YELLOW);
|
||||
} else {
|
||||
labelItem.setForeground(Color.BLACK);
|
||||
labelItem.setBackground(Color.LIGHT_GRAY);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.plaf.basic.BasicComboBoxEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class MyComboBoxEditor extends BasicComboBoxEditor {
|
||||
private final JLabel label;
|
||||
private final JPanel panel;
|
||||
private Object selectedItem;
|
||||
|
||||
public MyComboBoxEditor() {
|
||||
label = new JLabel();
|
||||
panel = new JPanel();
|
||||
|
||||
label.setOpaque(false);
|
||||
label.setFont(new Font("Arial", Font.BOLD, 14));
|
||||
label.setForeground(Color.BLACK);
|
||||
|
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2));
|
||||
panel.add(label);
|
||||
panel.setBackground(Color.BLUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getEditorComponent() {
|
||||
return this.panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem() {
|
||||
return "[" + this.selectedItem.toString() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem(Object item) {
|
||||
this.selectedItem = item;
|
||||
label.setText(item.toString());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.ListCellRenderer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MyComboBoxRenderer extends JLabel implements ListCellRenderer {
|
||||
|
||||
public MyComboBoxRenderer() {
|
||||
setOpaque(true);
|
||||
setFont(new Font("Arial", Font.BOLD /*| Font.ITALIC*/, 14));
|
||||
setBackground(Color.BLUE);
|
||||
setForeground(Color.YELLOW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value,
|
||||
int index, boolean isSelected, boolean cellHasFocus) {
|
||||
setText(value.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
BIN
Mage.Client/src/main/resources/flags/ad.png
Normal file
After ![]() (image error) Size: 643 B |
BIN
Mage.Client/src/main/resources/flags/ae.png
Normal file
After ![]() (image error) Size: 408 B |
BIN
Mage.Client/src/main/resources/flags/af.png
Normal file
After ![]() (image error) Size: 604 B |
BIN
Mage.Client/src/main/resources/flags/ag.png
Normal file
After ![]() (image error) Size: 591 B |
BIN
Mage.Client/src/main/resources/flags/ai.png
Normal file
After ![]() (image error) Size: 643 B |
BIN
Mage.Client/src/main/resources/flags/al.png
Normal file
After ![]() (image error) Size: 600 B |
BIN
Mage.Client/src/main/resources/flags/am.png
Normal file
After ![]() (image error) Size: 497 B |
BIN
Mage.Client/src/main/resources/flags/an.png
Normal file
After ![]() (image error) Size: 488 B |
BIN
Mage.Client/src/main/resources/flags/ao.png
Normal file
After ![]() (image error) Size: 428 B |
BIN
Mage.Client/src/main/resources/flags/ar.png
Normal file
After ![]() (image error) Size: 506 B |
BIN
Mage.Client/src/main/resources/flags/as.png
Normal file
After ![]() (image error) Size: 647 B |
BIN
Mage.Client/src/main/resources/flags/at.png
Normal file
After ![]() (image error) Size: 403 B |
BIN
Mage.Client/src/main/resources/flags/au.png
Normal file
After ![]() (image error) Size: 673 B |
BIN
Mage.Client/src/main/resources/flags/aw.png
Normal file
After ![]() (image error) Size: 524 B |
BIN
Mage.Client/src/main/resources/flags/ax.png
Normal file
After ![]() (image error) Size: 663 B |
BIN
Mage.Client/src/main/resources/flags/az.png
Normal file
After ![]() (image error) Size: 589 B |
BIN
Mage.Client/src/main/resources/flags/ba.png
Normal file
After ![]() (image error) Size: 593 B |
BIN
Mage.Client/src/main/resources/flags/bb.png
Normal file
After ![]() (image error) Size: 585 B |
BIN
Mage.Client/src/main/resources/flags/bd.png
Normal file
After ![]() (image error) Size: 504 B |
BIN
Mage.Client/src/main/resources/flags/be.png
Normal file
After ![]() (image error) Size: 449 B |
BIN
Mage.Client/src/main/resources/flags/bf.png
Normal file
After ![]() (image error) Size: 497 B |
BIN
Mage.Client/src/main/resources/flags/bg.png
Normal file
After ![]() (image error) Size: 462 B |
BIN
Mage.Client/src/main/resources/flags/bh.png
Normal file
After ![]() (image error) Size: 457 B |
BIN
Mage.Client/src/main/resources/flags/bi.png
Normal file
After ![]() (image error) Size: 675 B |
BIN
Mage.Client/src/main/resources/flags/bj.png
Normal file
After ![]() (image error) Size: 486 B |
BIN
Mage.Client/src/main/resources/flags/bm.png
Normal file
After ![]() (image error) Size: 611 B |
BIN
Mage.Client/src/main/resources/flags/bn.png
Normal file
After ![]() (image error) Size: 639 B |
BIN
Mage.Client/src/main/resources/flags/bo.png
Normal file
After ![]() (image error) Size: 500 B |
BIN
Mage.Client/src/main/resources/flags/br.png
Normal file
After ![]() (image error) Size: 593 B |
BIN
Mage.Client/src/main/resources/flags/bs.png
Normal file
After ![]() (image error) Size: 526 B |
BIN
Mage.Client/src/main/resources/flags/bt.png
Normal file
After ![]() (image error) Size: 631 B |
BIN
Mage.Client/src/main/resources/flags/bv.png
Normal file
After ![]() (image error) Size: 512 B |
BIN
Mage.Client/src/main/resources/flags/bw.png
Normal file
After ![]() (image error) Size: 443 B |
BIN
Mage.Client/src/main/resources/flags/by.png
Normal file
After ![]() (image error) Size: 514 B |
BIN
Mage.Client/src/main/resources/flags/bz.png
Normal file
After ![]() (image error) Size: 600 B |
BIN
Mage.Client/src/main/resources/flags/ca.png
Normal file
After ![]() (image error) Size: 628 B |
BIN
Mage.Client/src/main/resources/flags/catalonia.png
Normal file
After ![]() (image error) Size: 398 B |
BIN
Mage.Client/src/main/resources/flags/cc.png
Normal file
After ![]() (image error) Size: 625 B |
BIN
Mage.Client/src/main/resources/flags/cd.png
Normal file
After ![]() (image error) Size: 528 B |
BIN
Mage.Client/src/main/resources/flags/cf.png
Normal file
After ![]() (image error) Size: 614 B |
BIN
Mage.Client/src/main/resources/flags/cg.png
Normal file
After ![]() (image error) Size: 521 B |
BIN
Mage.Client/src/main/resources/flags/ch.png
Normal file
After ![]() (image error) Size: 367 B |
BIN
Mage.Client/src/main/resources/flags/ci.png
Normal file
After ![]() (image error) Size: 453 B |
BIN
Mage.Client/src/main/resources/flags/ck.png
Normal file
After ![]() (image error) Size: 586 B |
BIN
Mage.Client/src/main/resources/flags/cl.png
Normal file
After ![]() (image error) Size: 450 B |
BIN
Mage.Client/src/main/resources/flags/cm.png
Normal file
After ![]() (image error) Size: 525 B |
BIN
Mage.Client/src/main/resources/flags/cn.png
Normal file
After ![]() (image error) Size: 472 B |
BIN
Mage.Client/src/main/resources/flags/co.png
Normal file
After ![]() (image error) Size: 483 B |
BIN
Mage.Client/src/main/resources/flags/cr.png
Normal file
After ![]() (image error) Size: 477 B |
BIN
Mage.Client/src/main/resources/flags/cs.png
Normal file
After ![]() (image error) Size: 439 B |
BIN
Mage.Client/src/main/resources/flags/cu.png
Normal file
After ![]() (image error) Size: 563 B |
BIN
Mage.Client/src/main/resources/flags/cv.png
Normal file
After ![]() (image error) Size: 529 B |
BIN
Mage.Client/src/main/resources/flags/cx.png
Normal file
After ![]() (image error) Size: 608 B |
BIN
Mage.Client/src/main/resources/flags/cy.png
Normal file
After ![]() (image error) Size: 428 B |
BIN
Mage.Client/src/main/resources/flags/cz.png
Normal file
After ![]() (image error) Size: 476 B |
BIN
Mage.Client/src/main/resources/flags/de.png
Normal file
After ![]() (image error) Size: 545 B |
BIN
Mage.Client/src/main/resources/flags/dj.png
Normal file
After ![]() (image error) Size: 572 B |
BIN
Mage.Client/src/main/resources/flags/dk.png
Normal file
After ![]() (image error) Size: 495 B |
BIN
Mage.Client/src/main/resources/flags/dm.png
Normal file
After ![]() (image error) Size: 620 B |
BIN
Mage.Client/src/main/resources/flags/do.png
Normal file
After ![]() (image error) Size: 508 B |
BIN
Mage.Client/src/main/resources/flags/dz.png
Normal file
After ![]() (image error) Size: 582 B |
BIN
Mage.Client/src/main/resources/flags/ec.png
Normal file
After ![]() (image error) Size: 500 B |
BIN
Mage.Client/src/main/resources/flags/ee.png
Normal file
After ![]() (image error) Size: 429 B |
BIN
Mage.Client/src/main/resources/flags/eg.png
Normal file
After ![]() (image error) Size: 465 B |
BIN
Mage.Client/src/main/resources/flags/eh.png
Normal file
After ![]() (image error) Size: 508 B |
BIN
Mage.Client/src/main/resources/flags/england.png
Normal file
After ![]() (image error) Size: 496 B |
BIN
Mage.Client/src/main/resources/flags/er.png
Normal file
After ![]() (image error) Size: 653 B |
BIN
Mage.Client/src/main/resources/flags/es.png
Normal file
After ![]() (image error) Size: 469 B |
BIN
Mage.Client/src/main/resources/flags/et.png
Normal file
After ![]() (image error) Size: 592 B |
BIN
Mage.Client/src/main/resources/flags/europeanunion.png
Normal file
After ![]() (image error) Size: 479 B |
BIN
Mage.Client/src/main/resources/flags/fi.png
Normal file
After ![]() (image error) Size: 489 B |
BIN
Mage.Client/src/main/resources/flags/fj.png
Normal file
After ![]() (image error) Size: 610 B |
BIN
Mage.Client/src/main/resources/flags/fk.png
Normal file
After ![]() (image error) Size: 648 B |
BIN
Mage.Client/src/main/resources/flags/fm.png
Normal file
After ![]() (image error) Size: 552 B |
BIN
Mage.Client/src/main/resources/flags/fo.png
Normal file
After ![]() (image error) Size: 474 B |
BIN
Mage.Client/src/main/resources/flags/fr.png
Normal file
After ![]() (image error) Size: 545 B |
BIN
Mage.Client/src/main/resources/flags/ga.png
Normal file
After ![]() (image error) Size: 489 B |
BIN
Mage.Client/src/main/resources/flags/gb.png
Normal file
After ![]() (image error) Size: 599 B |
BIN
Mage.Client/src/main/resources/flags/gd.png
Normal file
After ![]() (image error) Size: 637 B |
BIN
Mage.Client/src/main/resources/flags/ge.png
Normal file
After ![]() (image error) Size: 594 B |
BIN
Mage.Client/src/main/resources/flags/gf.png
Normal file
After ![]() (image error) Size: 545 B |
BIN
Mage.Client/src/main/resources/flags/gh.png
Normal file
After ![]() (image error) Size: 490 B |
BIN
Mage.Client/src/main/resources/flags/gi.png
Normal file
After ![]() (image error) Size: 463 B |
BIN
Mage.Client/src/main/resources/flags/gl.png
Normal file
After ![]() (image error) Size: 470 B |
BIN
Mage.Client/src/main/resources/flags/gm.png
Normal file
After ![]() (image error) Size: 493 B |
BIN
Mage.Client/src/main/resources/flags/gn.png
Normal file
After ![]() (image error) Size: 480 B |
BIN
Mage.Client/src/main/resources/flags/gp.png
Normal file
After ![]() (image error) Size: 488 B |
BIN
Mage.Client/src/main/resources/flags/gq.png
Normal file
After ![]() (image error) Size: 537 B |
BIN
Mage.Client/src/main/resources/flags/gr.png
Normal file
After ![]() (image error) Size: 487 B |