forked from External/mage
Merge pull request #243 from Noahsark/fab2759579276909b534de603feb01f50d326d37
Add UI to set background, fix a little bugs, combine theme plugins to client project to avoid cycling dependency
This commit is contained in:
commit
d6813e47c3
12 changed files with 814 additions and 66 deletions
|
|
@ -55,7 +55,7 @@
|
|||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="29" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
|
@ -88,7 +88,6 @@
|
|||
</Group>
|
||||
</Group>
|
||||
<Component id="jSeparator2" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="player1Panel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="pnlOtherPlayers" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
|
|
@ -119,13 +118,15 @@
|
|||
<Component id="cbDeckType" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbGameType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblGameType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" alignment="3" groupAlignment="3" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="spnFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbGameType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblGameType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
|
|
@ -156,12 +157,10 @@
|
|||
<Component id="jSeparator2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="player1Panel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlOtherPlayers" pref="140" max="32767" attributes="0"/>
|
||||
<Component id="pnlOtherPlayers" pref="205" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
|
@ -175,7 +174,7 @@
|
|||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="201" max="-2" attributes="0"/>
|
||||
<Component id="jSeparator3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="240" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="248" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -282,8 +281,6 @@
|
|||
<Property name="text" type="java.lang.String" value="Player 1 (You)"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.table.NewPlayerPanel" name="player1Panel">
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSeparator3">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import mage.Constants.RangeOfInfluence;
|
|||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.table.TablePlayerPanel;
|
||||
import mage.client.table.*;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
import mage.game.match.MatchOptions;
|
||||
|
|
@ -534,4 +534,4 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JTextField txtName;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -37,13 +37,13 @@
|
|||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jTabbedPane1" min="-2" pref="292" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jTabbedPane1" min="-2" pref="430" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="exitButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="saveButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="18" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jPanel7" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="92" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="230" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
<Component id="showToolTipsInAnyZone" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="displayBigCardsInHand" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="166" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="164" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="nonLandPermanentsInOnePile" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="204" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="202" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -262,7 +262,7 @@
|
|||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="105" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="103" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -334,7 +334,7 @@
|
|||
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkBoxEndTurnOthers" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="24" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="162" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -432,9 +432,12 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jPanel23" max="32767" attributes="0"/>
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -444,7 +447,9 @@
|
|||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="96" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jPanel23" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="39" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -487,7 +492,7 @@
|
|||
<Component id="saveToZipFiles" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="15" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -547,6 +552,149 @@
|
|||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel23">
|
||||
<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="Background images setting:">
|
||||
<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">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="useDefaultBackground" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="jLabel14" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="BackgroundImagePath" min="-2" pref="210" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="BackgroundBrowseButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jLabel15" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="BattlefieldImagePath" min="-2" pref="212" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="BattlefieldBrowseButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="useDefaultBattleImage" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="useRandomBattleImage" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" 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 max="-2" attributes="0"/>
|
||||
<Component id="useDefaultBackground" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="BackgroundImagePath" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="BackgroundBrowseButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel14" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="useDefaultBattleImage" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="useRandomBattleImage" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="BattlefieldImagePath" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="BattlefieldBrowseButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel15" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="21" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JCheckBox" name="useDefaultBackground">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="use default image"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useDefaultBackgroundActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="BackgroundImagePath">
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BackgroundImagePathActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="BackgroundBrowseButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Browse..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BackgroundBrowseButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="BattlefieldImagePath">
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BattlefieldImagePathActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="BattlefieldBrowseButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Browse..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BattlefieldBrowseButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="useDefaultBattleImage">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="default battlefield image"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useDefaultBattleImageActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="useRandomBattleImage">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="random battlefield image"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useRandomBattleImageActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel14">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Background:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel15">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Battlefield:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel22">
|
||||
|
|
@ -567,7 +715,7 @@
|
|||
<Component id="jEnableSounds" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jEnableMusics" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="325" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="323" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -578,7 +726,7 @@
|
|||
<Component id="jEnableSounds" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jEnableMusics" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="194" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="332" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -641,7 +789,7 @@
|
|||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlProxySettings" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="40" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="178" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -716,7 +864,7 @@
|
|||
<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="300" max="32767" attributes="1"/>
|
||||
<Component id="txtProxyServer" alignment="0" pref="298" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
|
|
@ -824,12 +972,12 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="0" pref="439" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="437" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="0" pref="264" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="402" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
|
@ -71,6 +72,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_CARD_IMAGES_PATH = "cardImagesPath";
|
||||
public static final String KEY_CARD_IMAGES_CHECK = "cardImagesCheck";
|
||||
public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip";
|
||||
|
||||
public static final String KEY_BACKGROUND_IMAGE = "backgroundImage";
|
||||
public static final String KEY_BATTLEFIELD_IMAGE = "battlefieldImage";
|
||||
public static final String KEY_BACKGROUND_IMAGE_DEFAULT = "backgroundImagedDefault";
|
||||
public static final String KEY_BATTLEFIELD_IMAGE_RANDOM = "battlefieldImagerandom";
|
||||
public static final String KEY_BATTLEFIELD_IMAGE_DEFAULT = "battlefieldImageDefault";
|
||||
|
||||
public static final String KEY_SOUNDS_ON = "soundsOn";
|
||||
public static final String KEY_MUSICS_ON = "MusicsOn";
|
||||
|
|
@ -143,7 +150,47 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
{
|
||||
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
}
|
||||
|
||||
private final JFileChooser fc_i = new JFileChooser();
|
||||
{
|
||||
fc_i.setAcceptAllFileFilterUsed(false);
|
||||
fc_i.addChoosableFileFilter(new ImageFileFilter(".jpg"));
|
||||
fc_i.addChoosableFileFilter(new ImageFileFilter(".jpeg"));
|
||||
fc_i.addChoosableFileFilter(new ImageFileFilter(".png"));
|
||||
fc_i.addChoosableFileFilter(new ImageFileFilter(".bmp"));
|
||||
}
|
||||
|
||||
private static class ImageFileFilter extends FileFilter{
|
||||
String extend;
|
||||
public ImageFileFilter(String extend){
|
||||
this.extend = extend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
String filename = f.getName();
|
||||
if(f.isDirectory()) return true;
|
||||
if(filename != null){
|
||||
if(filename.endsWith(extend)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if(extend.equals(".png") || extend.equals(".bmp"))
|
||||
return "Image File(*.png, *.bmp)";
|
||||
if(extend.equals(".jpg") || extend.equals(".jpg"))
|
||||
return "JEGP file(*.jpg,*.jepg)";
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Creates new form PreferencesDialog */
|
||||
public PreferencesDialog(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
|
|
@ -201,6 +248,16 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
browseButton = new javax.swing.JButton();
|
||||
checkForNewImages = new javax.swing.JCheckBox();
|
||||
saveToZipFiles = new javax.swing.JCheckBox();
|
||||
jPanel23 = new javax.swing.JPanel();
|
||||
useDefaultBackground = new javax.swing.JCheckBox();
|
||||
BackgroundImagePath = new javax.swing.JTextField();
|
||||
BackgroundBrowseButton = new javax.swing.JButton();
|
||||
BattlefieldImagePath = new javax.swing.JTextField();
|
||||
BattlefieldBrowseButton = new javax.swing.JButton();
|
||||
useDefaultBattleImage = new javax.swing.JCheckBox();
|
||||
useRandomBattleImage = new javax.swing.JCheckBox();
|
||||
jLabel14 = new javax.swing.JLabel();
|
||||
jLabel15 = new javax.swing.JLabel();
|
||||
jPanel22 = new javax.swing.JPanel();
|
||||
jEnableSounds = new javax.swing.JCheckBox();
|
||||
jEnableMusics = new javax.swing.JCheckBox();
|
||||
|
|
@ -268,7 +325,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(showToolTipsInAnyZone)
|
||||
.addComponent(displayBigCardsInHand))
|
||||
.addContainerGap(166, Short.MAX_VALUE))
|
||||
.addContainerGap(164, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel3Layout.setVerticalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -296,7 +353,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(nonLandPermanentsInOnePile)
|
||||
.addContainerGap(204, Short.MAX_VALUE))
|
||||
.addContainerGap(202, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel7Layout.setVerticalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -325,7 +382,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(92, Short.MAX_VALUE))
|
||||
.addContainerGap(230, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Main", jPanel1);
|
||||
|
|
@ -398,7 +455,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)))
|
||||
.addContainerGap(105, Short.MAX_VALUE))
|
||||
.addContainerGap(103, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -453,7 +510,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addComponent(checkBoxEndTurnYou)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(checkBoxEndTurnOthers))
|
||||
.addContainerGap(24, Short.MAX_VALUE))
|
||||
.addContainerGap(162, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Phases", jPanel2);
|
||||
|
|
@ -508,7 +565,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(saveToZipFiles)))
|
||||
.addContainerGap(15, Short.MAX_VALUE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel5Layout.setVerticalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -526,13 +583,122 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addContainerGap(22, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Background images setting:"));
|
||||
|
||||
useDefaultBackground.setText("use default image");
|
||||
useDefaultBackground.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
useDefaultBackgroundActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
BackgroundImagePath.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
BackgroundImagePathActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
BackgroundBrowseButton.setText("Browse...");
|
||||
BackgroundBrowseButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
BackgroundBrowseButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
BattlefieldImagePath.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
BattlefieldImagePathActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
BattlefieldBrowseButton.setText("Browse...");
|
||||
BattlefieldBrowseButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
BattlefieldBrowseButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
useDefaultBattleImage.setText("default battlefield image");
|
||||
useDefaultBattleImage.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
useDefaultBattleImageActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
useRandomBattleImage.setText("random battlefield image");
|
||||
useRandomBattleImage.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
useRandomBattleImageActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel14.setText("Background:");
|
||||
|
||||
jLabel15.setText("Battlefield:");
|
||||
|
||||
javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
|
||||
jPanel23.setLayout(jPanel23Layout);
|
||||
jPanel23Layout.setHorizontalGroup(
|
||||
jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel23Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel23Layout.createSequentialGroup()
|
||||
.addComponent(useDefaultBackground)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel23Layout.createSequentialGroup()
|
||||
.addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(jPanel23Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(jLabel14)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(BackgroundImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(BackgroundBrowseButton))
|
||||
.addGroup(jPanel23Layout.createSequentialGroup()
|
||||
.addComponent(jLabel15)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(BattlefieldImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(BattlefieldBrowseButton)))
|
||||
.addGap(18, 18, 18))
|
||||
.addGroup(jPanel23Layout.createSequentialGroup()
|
||||
.addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(useDefaultBattleImage)
|
||||
.addComponent(useRandomBattleImage))
|
||||
.addGap(0, 0, Short.MAX_VALUE))))
|
||||
);
|
||||
jPanel23Layout.setVerticalGroup(
|
||||
jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel23Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(useDefaultBackground)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(BackgroundImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(BackgroundBrowseButton)
|
||||
.addComponent(jLabel14))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(useDefaultBattleImage)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(useRandomBattleImage)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(BattlefieldImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(BattlefieldBrowseButton)
|
||||
.addComponent(jLabel15))
|
||||
.addContainerGap(21, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
||||
jPanel4.setLayout(jPanel4Layout);
|
||||
jPanel4Layout.setHorizontalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jPanel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
|
|
@ -540,7 +706,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(96, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jPanel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(39, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Images", jPanel4);
|
||||
|
|
@ -568,7 +736,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jEnableSounds)
|
||||
.addComponent(jEnableMusics))
|
||||
.addContainerGap(325, Short.MAX_VALUE))
|
||||
.addContainerGap(323, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel22Layout.setVerticalGroup(
|
||||
jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -577,7 +745,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addComponent(jEnableSounds)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jEnableMusics)
|
||||
.addContainerGap(194, Short.MAX_VALUE))
|
||||
.addContainerGap(332, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Sounds", jPanel22);
|
||||
|
|
@ -645,7 +813,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.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, 300, Short.MAX_VALUE))
|
||||
.addComponent(txtProxyServer, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
pnlProxyLayout.setVerticalGroup(
|
||||
|
|
@ -715,7 +883,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.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(40, Short.MAX_VALUE))
|
||||
.addContainerGap(178, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pnlProxySettings.getAccessibleContext().setAccessibleDescription("");
|
||||
|
|
@ -960,11 +1128,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
jPanel8.setLayout(jPanel8Layout);
|
||||
jPanel8Layout.setHorizontalGroup(
|
||||
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE)
|
||||
);
|
||||
jPanel8Layout.setVerticalGroup(
|
||||
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Avatars", jPanel8);
|
||||
|
|
@ -998,12 +1166,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 430, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(exitButton)
|
||||
.addComponent(saveButton))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(18, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
|
@ -1039,6 +1207,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
saveImagesPath(prefs);
|
||||
save(prefs, dialog.checkForNewImages, KEY_CARD_IMAGES_CHECK, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.saveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY);
|
||||
|
||||
save(prefs, dialog.useDefaultBackground, KEY_BACKGROUND_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.useDefaultBattleImage, KEY_BATTLEFIELD_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.useRandomBattleImage, KEY_BATTLEFIELD_IMAGE_RANDOM, "true", "false", UPDATE_CACHE_POLICY);
|
||||
|
||||
// sounds
|
||||
save(prefs, dialog.jEnableSounds, KEY_SOUNDS_ON, "true", "false", UPDATE_CACHE_POLICY);
|
||||
|
|
@ -1103,7 +1275,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
|
||||
int returnVal = fc.showOpenDialog(PreferencesDialog.this);
|
||||
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
imageFolderPath.setText(file.getAbsolutePath());
|
||||
|
|
@ -1141,6 +1313,100 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private void jEnableMusicsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jEnableMusicsActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jEnableMusicsActionPerformed
|
||||
|
||||
private void useDefaultBackgroundActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if(useDefaultBackground.isSelected()){
|
||||
useDefualtBackgroundImage();
|
||||
}else{
|
||||
useSelectBackgroundImage();
|
||||
}
|
||||
}
|
||||
|
||||
private void useDefualtBackgroundImage(){
|
||||
BackgroundImagePath.setEnabled(false);
|
||||
BackgroundBrowseButton.setEnabled(false);
|
||||
BackgroundImagePath.setText("");
|
||||
}
|
||||
|
||||
private void useSelectBackgroundImage(){
|
||||
String path = cache.get(KEY_BACKGROUND_IMAGE);
|
||||
dialog.BackgroundImagePath.setText(path);
|
||||
BackgroundImagePath.setEnabled(true);
|
||||
BackgroundBrowseButton.setEnabled(true);
|
||||
}
|
||||
|
||||
private void useDefaultBattleImageActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if(useDefaultBattleImage.isSelected()){
|
||||
useDefaultBattlefield();
|
||||
}else{
|
||||
useSelectedOrRandom();
|
||||
}
|
||||
}
|
||||
|
||||
private void useDefaultBattlefield(){
|
||||
useRandomBattleImage.setEnabled(false);
|
||||
BattlefieldImagePath.setEnabled(false);
|
||||
BattlefieldBrowseButton.setEnabled(false);
|
||||
}
|
||||
|
||||
private void useSelectedOrRandom(){
|
||||
useRandomBattleImage.setEnabled(true);
|
||||
String temp = cache.get(KEY_BATTLEFIELD_IMAGE_RANDOM);
|
||||
if(temp != null){
|
||||
if(temp.equals("true")){
|
||||
useRandomBattleField();
|
||||
useRandomBattleImage.setSelected(true);
|
||||
}else{
|
||||
useSelectedBattleField();
|
||||
useRandomBattleImage.setSelected(false);
|
||||
}
|
||||
}else{
|
||||
useSelectedBattleField();
|
||||
useRandomBattleImage.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void useRandomBattleImageActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if(useRandomBattleImage.isSelected()){
|
||||
useRandomBattleField();
|
||||
}else{
|
||||
useSelectedBattleField();
|
||||
}
|
||||
}
|
||||
|
||||
private void useRandomBattleField(){
|
||||
BattlefieldImagePath.setEnabled(false);
|
||||
BattlefieldBrowseButton.setEnabled(false);
|
||||
}
|
||||
|
||||
private void useSelectedBattleField(){
|
||||
BattlefieldImagePath.setEnabled(true);
|
||||
BattlefieldBrowseButton.setEnabled(true);
|
||||
}
|
||||
|
||||
private void BackgroundBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
int returnVal = fc_i.showOpenDialog(PreferencesDialog.this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc_i.getSelectedFile();
|
||||
BackgroundImagePath.setText(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
private void BattlefieldBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
int returnVal = fc_i.showOpenDialog(PreferencesDialog.this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc_i.getSelectedFile();
|
||||
BattlefieldImagePath.setText(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
private void BackgroundImagePathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackgroundImagePathActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_BackgroundImagePathActionPerformed
|
||||
|
||||
private void BattlefieldImagePathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BattlefieldImagePathActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_BattlefieldImagePathActionPerformed
|
||||
|
||||
private void showProxySettings() {
|
||||
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
|
||||
|
|
@ -1240,6 +1506,39 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
load(prefs, dialog.checkForNewImages, KEY_CARD_IMAGES_CHECK, "true");
|
||||
load(prefs, dialog.saveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true");
|
||||
//add background load precedure
|
||||
prop = prefs.get(KEY_BACKGROUND_IMAGE_DEFAULT, "true");
|
||||
if(prop.equals("true")){
|
||||
dialog.useDefaultBackground.setSelected(true);
|
||||
dialog.useDefualtBackgroundImage();
|
||||
}else{
|
||||
dialog.useDefaultBackground.setSelected(false);
|
||||
dialog.useSelectBackgroundImage();
|
||||
String path = prefs.get(KEY_BACKGROUND_IMAGE, "");
|
||||
dialog.BackgroundImagePath.setText(path);
|
||||
updateCache(KEY_BACKGROUND_IMAGE, path);
|
||||
}
|
||||
prop = prefs.get(KEY_BATTLEFIELD_IMAGE_DEFAULT, "true");
|
||||
if(prop.equals("true")){
|
||||
dialog.useDefaultBattleImage.setSelected(true);
|
||||
dialog.useDefaultBattlefield();
|
||||
}else{
|
||||
dialog.useDefaultBattleImage.setSelected(false);
|
||||
dialog.useSelectedOrRandom();
|
||||
}
|
||||
prop = prefs.get(KEY_BATTLEFIELD_IMAGE_RANDOM, "true");
|
||||
|
||||
if(dialog.useRandomBattleImage.isEnabled())
|
||||
if(prop.equals("true")){
|
||||
dialog.useRandomBattleImage.setSelected(true);
|
||||
dialog.useRandomBattleField();
|
||||
}else{
|
||||
dialog.useRandomBattleImage.setSelected(false);
|
||||
dialog.useSelectedBattleField();
|
||||
String path = prefs.get(KEY_BATTLEFIELD_IMAGE, "");
|
||||
dialog.BattlefieldImagePath.setText(path);
|
||||
updateCache(KEY_BATTLEFIELD_IMAGE, path);
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadSoundSettings(Preferences prefs) {
|
||||
|
|
@ -1298,13 +1597,23 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private static void saveImagesPath(Preferences prefs) {
|
||||
if (!dialog.useDefaultImageFolder.isSelected()) {
|
||||
String path = dialog.imageFolderPath.getText();
|
||||
prefs.put(KEY_CARD_IMAGES_PATH, path);
|
||||
updateCache(KEY_CARD_IMAGES_PATH, path);
|
||||
}
|
||||
// background path save precedure
|
||||
if(!dialog.useDefaultBackground.isSelected()){
|
||||
String path = dialog.BackgroundImagePath.getText();
|
||||
prefs.put(KEY_BACKGROUND_IMAGE, path);
|
||||
updateCache(KEY_BACKGROUND_IMAGE, path);
|
||||
}
|
||||
if(!dialog.useDefaultBattleImage.isSelected() && !dialog.useRandomBattleImage.isSelected()){
|
||||
String path = dialog.BattlefieldImagePath.getText();
|
||||
prefs.put(KEY_BATTLEFIELD_IMAGE, path);
|
||||
updateCache(KEY_BATTLEFIELD_IMAGE, path);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSaveImagesToZip() {
|
||||
|
|
@ -1453,6 +1762,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton BackgroundBrowseButton;
|
||||
private javax.swing.JTextField BackgroundImagePath;
|
||||
private javax.swing.JButton BattlefieldBrowseButton;
|
||||
private javax.swing.JTextField BattlefieldImagePath;
|
||||
private javax.swing.JButton browseButton;
|
||||
private javax.swing.JComboBox cbProxyType;
|
||||
private javax.swing.JCheckBox checkBoxBeforeCOthers;
|
||||
|
|
@ -1480,6 +1793,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel12;
|
||||
private javax.swing.JLabel jLabel13;
|
||||
private javax.swing.JLabel jLabel14;
|
||||
private javax.swing.JLabel jLabel15;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
|
|
@ -1503,6 +1818,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JPanel jPanel20;
|
||||
private javax.swing.JPanel jPanel21;
|
||||
private javax.swing.JPanel jPanel22;
|
||||
private javax.swing.JPanel jPanel23;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JPanel jPanel5;
|
||||
|
|
@ -1528,7 +1844,10 @@ 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.JCheckBox useDefaultBackground;
|
||||
private javax.swing.JCheckBox useDefaultBattleImage;
|
||||
private javax.swing.JCheckBox useDefaultImageFolder;
|
||||
private javax.swing.JCheckBox useRandomBattleImage;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private static final PreferencesDialog dialog = new PreferencesDialog(new javax.swing.JFrame(), true);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import net.xeoh.plugins.base.PluginManager;
|
|||
import net.xeoh.plugins.base.impl.PluginManagerFactory;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.CardPluginImpl;
|
||||
import org.mage.plugins.theme.ThemePluginImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
|
@ -54,7 +55,8 @@ public class Plugins implements MagePlugins {
|
|||
pm.addPluginsFrom(new File(PLUGINS_DIRECTORY).toURI());
|
||||
this.cardPlugin = new CardPluginImpl();
|
||||
this.counterPlugin = pm.getPlugin(CounterPlugin.class);
|
||||
this.themePlugin = pm.getPlugin(ThemePlugin.class);
|
||||
//this.themePlugin = pm.getPlugin(ThemePlugin.class);
|
||||
this.themePlugin = new ThemePluginImpl();
|
||||
logger.info("Done.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,210 @@
|
|||
package org.mage.plugins.theme;
|
||||
|
||||
import mage.components.ImagePanel;
|
||||
import mage.interfaces.plugin.ThemePlugin;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import net.xeoh.plugins.base.annotations.PluginImplementation;
|
||||
import net.xeoh.plugins.base.annotations.events.Init;
|
||||
import net.xeoh.plugins.base.annotations.events.PluginLoaded;
|
||||
import net.xeoh.plugins.base.annotations.meta.Author;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.*;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
@PluginImplementation
|
||||
@Author(name = "nantuko")
|
||||
public class ThemePluginImpl implements ThemePlugin {
|
||||
|
||||
private static final Logger log = Logger.getLogger(ThemePluginImpl.class);
|
||||
private static BufferedImage background;
|
||||
private List flist = new List();
|
||||
private String BackgroundDir = "plugins" + File.separator + "plugin.data" + File.separator
|
||||
+ "background" + File.separator;
|
||||
@Init
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@PluginLoaded
|
||||
public void newPlugin(ThemePlugin plugin) {
|
||||
log.info(plugin.toString() + " has been loaded.");
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[Theme plugin, version 0.5]";
|
||||
}
|
||||
|
||||
public boolean loadimages(){
|
||||
File filedir = new File(BackgroundDir);
|
||||
File[] filelist = filedir.listFiles();
|
||||
if(filelist == null) return false;
|
||||
if(filelist.length == 0) return false;
|
||||
for(File f:filelist){
|
||||
String filename = f.getName().toLowerCase();
|
||||
if(filename != null && (filename.endsWith(".png") || filename.endsWith(".jpg")
|
||||
|| filename.endsWith(".bmp"))){
|
||||
flist.add(filename);
|
||||
}
|
||||
}
|
||||
if(flist.getItemCount() == 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void applyInGame(Map<String, JComponent> ui) {
|
||||
BufferedImage background;
|
||||
try {
|
||||
|
||||
if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_DEFAULT,
|
||||
"true").equals("true")){
|
||||
|
||||
background = loadbuffer_default();
|
||||
|
||||
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_RANDOM,
|
||||
"true").equals("true")){
|
||||
|
||||
background = loadbuffer_random();
|
||||
|
||||
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE, "") != null){
|
||||
|
||||
background = loadbuffer_selected();
|
||||
|
||||
}else{
|
||||
background = loadbuffer_default();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if(loadimages()){
|
||||
int it = (int)Math.abs(Math.random()*(flist.getItemCount()));
|
||||
filename = BackgroundDir + flist.getItem(it);
|
||||
background = ImageIO.read(new File(filename));
|
||||
}else{
|
||||
filename = "/dragon.png";
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
if (is == null)
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
background = ImageIO.read(is);
|
||||
}
|
||||
*/
|
||||
if (background == null) {
|
||||
throw new FileNotFoundException("Couldn't find background file in resources.");
|
||||
}
|
||||
|
||||
if (ui.containsKey("gamePanel") && ui.containsKey("jLayeredPane")) {
|
||||
ImagePanel bgPanel = new ImagePanel(background, ImagePanel.TILED);
|
||||
|
||||
unsetOpaque(ui.get("jSplitPane1"));
|
||||
unsetOpaque(ui.get("pnlBattlefield"));
|
||||
unsetOpaque(ui.get("jPanel3"));
|
||||
unsetOpaque(ui.get("hand"));
|
||||
unsetOpaque(ui.get("gameChatPanel"));
|
||||
unsetOpaque(ui.get("userChatPanel"));
|
||||
|
||||
ui.get("gamePanel").remove(ui.get("jLayeredPane"));
|
||||
bgPanel.add(ui.get("jLayeredPane"));
|
||||
ui.get("gamePanel").add(bgPanel);
|
||||
} else {
|
||||
log.error("error: no components");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private BufferedImage loadbuffer_default() throws IOException{
|
||||
String filename = "/dragon.png";
|
||||
BufferedImage res;
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
res = ImageIO.read(is);
|
||||
return res;
|
||||
}
|
||||
|
||||
private BufferedImage loadbuffer_random() throws IOException{
|
||||
BufferedImage res;
|
||||
if(loadimages()){
|
||||
int it = (int)Math.abs(Math.random()*(flist.getItemCount()));
|
||||
String filename = BackgroundDir + flist.getItem(it);
|
||||
res = ImageIO.read(new File(filename));
|
||||
return res;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private BufferedImage loadbuffer_selected() throws IOException{
|
||||
BufferedImage res;
|
||||
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BATTLEFIELD_IMAGE, "");
|
||||
if(path != null){
|
||||
res = ImageIO.read(new File(path));
|
||||
return res;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public JComponent updateTable(Map<String, JComponent> ui) {
|
||||
ImagePanel bgPanel = createImagePanelInstance();
|
||||
|
||||
unsetOpaque(ui.get("jScrollPane1"));
|
||||
unsetOpaque(ui.get("jPanel1"));
|
||||
unsetOpaque(ui.get("tablesPanel"));
|
||||
JComponent viewport = ui.get("jScrollPane1ViewPort");
|
||||
if (viewport != null) {
|
||||
viewport.setBackground(new Color(255,255,255,50));
|
||||
}
|
||||
return bgPanel;
|
||||
}
|
||||
|
||||
private ImagePanel createImagePanelInstance() {
|
||||
if (background == null) {
|
||||
synchronized (ThemePluginImpl.class) {
|
||||
if (background == null) {
|
||||
String filename = "/background.png";
|
||||
try {
|
||||
if(PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BACKGROUND_IMAGE_DEFAULT, "true").equals("true")){
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
if (is == null)
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
background = ImageIO.read(is);
|
||||
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BACKGROUND_IMAGE, "") != null){
|
||||
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BATTLEFIELD_IMAGE, "");
|
||||
if(path != null){
|
||||
background = ImageIO.read(new File(path));
|
||||
}else{
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
if (is == null)
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
background = ImageIO.read(is);
|
||||
}
|
||||
}
|
||||
|
||||
if (background == null)
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ImagePanel(background, ImagePanel.SCALED);
|
||||
}
|
||||
|
||||
private void unsetOpaque(JComponent c) {
|
||||
if (c != null) {
|
||||
c.setOpaque(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Mage.Client/src/main/resources/background.png
Normal file
BIN
Mage.Client/src/main/resources/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 575 KiB |
BIN
Mage.Client/src/main/resources/dk_gray.jpg
Normal file
BIN
Mage.Client/src/main/resources/dk_gray.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
BIN
Mage.Client/src/main/resources/dragon.png
Normal file
BIN
Mage.Client/src/main/resources/dragon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 MiB |
BIN
Mage.Client/src/main/resources/green.jpg
Normal file
BIN
Mage.Client/src/main/resources/green.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
|
|
@ -32,6 +32,11 @@
|
|||
<version>1.2.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mage-client</artifactId>
|
||||
<version>1.0.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.mage.plugins.theme;
|
|||
|
||||
import mage.components.ImagePanel;
|
||||
import mage.interfaces.plugin.ThemePlugin;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import net.xeoh.plugins.base.annotations.PluginImplementation;
|
||||
import net.xeoh.plugins.base.annotations.events.Init;
|
||||
import net.xeoh.plugins.base.annotations.events.PluginLoaded;
|
||||
|
|
@ -13,7 +14,7 @@ import javax.swing.*;
|
|||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.*;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -53,11 +54,33 @@ public class ThemePluginImpl implements ThemePlugin {
|
|||
}
|
||||
if(flist.getItemCount() == 0) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void applyInGame(Map<String, JComponent> ui) {
|
||||
String filename;
|
||||
BufferedImage background;
|
||||
try {
|
||||
try {
|
||||
|
||||
if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_DEFAULT,
|
||||
"true").equals("true")){
|
||||
|
||||
background = loadbuffer_default();
|
||||
|
||||
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE_RANDOM,
|
||||
"true").equals("true")){
|
||||
|
||||
background = loadbuffer_random();
|
||||
|
||||
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE, "") != null){
|
||||
|
||||
background = loadbuffer_selected();
|
||||
|
||||
}else{
|
||||
background = loadbuffer_default();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if(loadimages()){
|
||||
int it = (int)Math.abs(Math.random()*(flist.getItemCount()));
|
||||
filename = BackgroundDir + flist.getItem(it);
|
||||
|
|
@ -69,9 +92,9 @@ public class ThemePluginImpl implements ThemePlugin {
|
|||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
background = ImageIO.read(is);
|
||||
}
|
||||
|
||||
*/
|
||||
if (background == null) {
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
throw new FileNotFoundException("Couldn't find background file in resources.");
|
||||
}
|
||||
|
||||
if (ui.containsKey("gamePanel") && ui.containsKey("jLayeredPane")) {
|
||||
|
|
@ -95,6 +118,37 @@ public class ThemePluginImpl implements ThemePlugin {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private BufferedImage loadbuffer_default() throws IOException{
|
||||
String filename = "/dragon.png";
|
||||
BufferedImage res;
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
res = ImageIO.read(is);
|
||||
return res;
|
||||
}
|
||||
|
||||
private BufferedImage loadbuffer_random() throws IOException{
|
||||
BufferedImage res;
|
||||
if(loadimages()){
|
||||
int it = (int)Math.abs(Math.random()*(flist.getItemCount()));
|
||||
String filename = BackgroundDir + flist.getItem(it);
|
||||
res = ImageIO.read(new File(filename));
|
||||
return res;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private BufferedImage loadbuffer_selected() throws IOException{
|
||||
BufferedImage res;
|
||||
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BATTLEFIELD_IMAGE, "");
|
||||
if(path != null){
|
||||
res = ImageIO.read(new File(path));
|
||||
return res;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public JComponent updateTable(Map<String, JComponent> ui) {
|
||||
|
|
@ -116,13 +170,26 @@ public class ThemePluginImpl implements ThemePlugin {
|
|||
if (background == null) {
|
||||
String filename = "/background.png";
|
||||
try {
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
|
||||
if (is == null)
|
||||
if(PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BACKGROUND_IMAGE_DEFAULT, "true").equals("true")){
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
if (is == null)
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
|
||||
background = ImageIO.read(is);
|
||||
|
||||
background = ImageIO.read(is);
|
||||
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BACKGROUND_IMAGE, "") != null){
|
||||
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
|
||||
KEY_BATTLEFIELD_IMAGE, "");
|
||||
if(path != null){
|
||||
background = ImageIO.read(new File(path));
|
||||
}else{
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
if (is == null)
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
background = ImageIO.read(is);
|
||||
}
|
||||
}
|
||||
|
||||
if (background == null)
|
||||
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue