/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConfigurationPanel.java
 *
 * Created on 01.02.2010, 22:33:44
 */

package csa.config;

import csa.config.sound.SoundMap;
import csa.config.sound.SoundMapPool;
import csa.config.theme.ThemeDataPanel;
import csa.gui.ImageCache;
import csa.gui.Windowable;
import csa.gui.components.CSAView;
import csa.gui.dialogs.InternalFrameFileChoser;
import csa.gui.ImageCacheWatchFrame;
import csa.gui.Scaler;
import csa.sound.PlayClip;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;
/**
 *
 * @author Malban
 */
public class ConfigurationPanel extends javax.swing.JPanel implements Windowable{

    private int mClassSetting=0;

    private CSAView mParent = null;
    private javax.swing.JMenuItem mParentMenuItem = null;

    @Override
    public void closing(){}
    @Override
    public void setParentWindow(CSAView jpv)
    {
        mParent = jpv;
    }
    @Override
    public void setMenuItem(javax.swing.JMenuItem item)
    {
        mParentMenuItem = item;
        mParentMenuItem.setText("Configuration");
    }
    @Override
    public javax.swing.JMenuItem getMenuItem()
    {
        return mParentMenuItem;
    }
    @Override
    public javax.swing.JPanel getPanel()
    {
        return this;
    }

    /** Creates new form ConfigurationPanel */
    public ConfigurationPanel()
    {
        initComponents();
        jCheckBoxResize.setVisible(false);
        jButton12.setVisible(false);
        jTextFieldAIImagePath.setVisible(false);
        jLabel15.setVisible(false);
        setScreenModes();
        SoundMapPool mSoundMapPool = new SoundMapPool();

        Collection<SoundMap> colC = mSoundMapPool.getHashMap().values();
        Iterator<SoundMap> iterC = colC.iterator();

        jComboBoxSoundMap.removeAllItems();
        while (iterC.hasNext())
        {
            SoundMap item = iterC.next();
            jComboBoxSoundMap.addItem(item.mName);
        }
        jComboBoxSoundMap.setSelectedIndex(-1);

        Vector<String> themes = Configuration.getConfiguration().getAllThemes();
        jComboBoxThemes.removeAllItems();
        for (int i = 0; i < themes.size(); i++) {
            String string = themes.elementAt(i);
            jComboBoxThemes.addItem(string);
        }
        setAllFromCurrent();
    }

    private void setAllFromCurrent() /* allneeded*/
    {
        mClassSetting++;

        Configuration C = Configuration.getConfiguration();

        jComboBoxThemes.setSelectedItem(C.getThemeName());
        
        jCheckBoxNoSound.setSelected(C.isSoundQuiet());
        
        jTextFieldFXCache1.setText(""+PlayClip.mClipMap.size());
        jComboBoxSoundMap.setSelectedItem(C.getSoundMapName());
        jCheckBoxDisableFileLogging.setSelected(C.isFileLoggingDisabled());
        jCheckBoxFirstTime.setSelected(C.isFirstTime());
        jCheckBoxPlayMusic.setSelected(C.isPlayTitleMusic());
        jTextFieldTtileMusic.setText(C.getTitleMusic());
        jCheckBoxShowTipOfDay1.setSelected(C.isShowTOD());
        jSliderVolume.setValue(C.getSoundVolumne());

        jCheckBoxDebugOff.setSelected(C.isDebugOff());
        jTextFieldDebugLevel.setText(""+C.getDebugLevel());
        jTextFieldFiles.setText(""+C.getDebugFiles());
        jTextFieldClasses.setText(""+C.getDebugClasses());
        jTextFieldMethods.setText(""+C.getDebugMethods());
        jCheckBoxDebugTiming.setSelected(C.isDebugTiming());
        jCheckBoxDebugFileOnly.setSelected(C.isDebugFileOnly());

        jTextFieldImageCache.setText("");
        jCheckBoxStartInFullscrren.setSelected(C.isStartInFullScrren());

        correctScreenModeIfNeccessary();
        jComboBoxScreenModes.setSelectedItem(C.getFullScrrenResString());
        jCheckBoxoverlappedScaling.setSelected(Scaler.overlappedScaling);
        mClassSetting--;
    }

    private void readAllToCurrent() /* allneeded*/
    {
        Configuration C = Configuration.getConfiguration();
        String t = (String)jComboBoxThemes.getSelectedItem();
        C.setThemeName(t);
        
        Integer I=100;
        try
        {
            C.setDebugLevel(Integer.parseInt(jTextFieldDebugLevel.getText()));
        }
        catch (Throwable e) {}
        C.setSoundQuiet(jCheckBoxNoSound.isSelected());

        C.setDebugFiles(jTextFieldFiles.getText());
        C.setDebugClasses(jTextFieldClasses.getText());
        C.setDebugMethods(jTextFieldMethods.getText());
        C.setDebugTiming(jCheckBoxDebugTiming.isSelected());
        C.setDebugOff(jCheckBoxDebugOff.isSelected());
        C.setDebugFileOnly(jCheckBoxDebugFileOnly.isSelected());
        C.setTitleMusic(jTextFieldTtileMusic.getText());
        C.setFirstTime(jCheckBoxFirstTime.isSelected());
        C.setFileLoggingDisabled(jCheckBoxDisableFileLogging.isSelected());
        
        if (jComboBoxSoundMap.getSelectedIndex()!=-1)
            C.setSoundMapName(jComboBoxSoundMap.getSelectedItem().toString());
        else
            C.setSoundMapName("");

        C.setShowTOD(jCheckBoxShowTipOfDay1.isSelected());
        C.setPlayTitleMusic(jCheckBoxPlayMusic.isSelected());

        C.setStartInFullScrren(jCheckBoxStartInFullscrren.isSelected());
        if (jComboBoxScreenModes.getSelectedIndex() == -1)
        {
            GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice[] devices = env.getScreenDevices();
            DisplayMode[] modes = devices[0].getDisplayModes();

            for (int i = 0; i < modes.length; i++)
            {
                DisplayMode displayMode = modes[i];
                String m = "";
                m+= displayMode.getWidth()+"x";
                m+= displayMode.getHeight()+" ";
                m+= displayMode.getBitDepth()+"bit ";
                m+= displayMode.getRefreshRate()+"Hz";
                if (displayMode.getWidth()==1024)
                {
                    jComboBoxScreenModes.setSelectedItem(m);
                    break;
                }
            }
        }
        C.setFullScrrenResString((String) jComboBoxScreenModes.getSelectedItem());


        C.setSoundVolumne(jSliderVolume.getValue());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jTextFieldDebugLevel = new javax.swing.JTextField();
        jCheckBoxDebugWindow = new javax.swing.JCheckBox();
        jButton2 = new javax.swing.JButton();
        jCheckBoxDebugTiming = new javax.swing.JCheckBox();
        jTextFieldFiles = new javax.swing.JTextField();
        jTextFieldClasses = new javax.swing.JTextField();
        jTextFieldMethods = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jCheckBoxDebugOff = new javax.swing.JCheckBox();
        jCheckBoxDebugFileOnly = new javax.swing.JCheckBox();
        jButton5 = new javax.swing.JButton();
        jCheckBoxDisableFileLogging = new javax.swing.JCheckBox();
        jCheckBoxInfoInPanel = new javax.swing.JCheckBox();
        jCheckBoxAutoSave = new javax.swing.JCheckBox();
        jPanel6 = new javax.swing.JPanel();
        jCheckBoxScriptCache = new javax.swing.JCheckBox();
        jTextFieldScriptCache = new javax.swing.JTextField();
        jButtonScriptCache = new javax.swing.JButton();
        jButtonImageCache = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jTextFieldImageCache = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jTextFieldFXCache1 = new javax.swing.JTextField();
        jButtonFXCache = new javax.swing.JButton();
        jLabel18 = new javax.swing.JLabel();
        jButtonHintsCache = new javax.swing.JButton();
        jTextFieldHintsCache = new javax.swing.JTextField();
        jLabel31 = new javax.swing.JLabel();
        jButtonCacheWatch = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jCheckBoxFirstTime = new javax.swing.JCheckBox();
        jCheckBox1 = new javax.swing.JCheckBox();
        jTextField1 = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jCheckBoxStartInFullscrren = new javax.swing.JCheckBox();
        jLabel13 = new javax.swing.JLabel();
        jComboBoxScreenModes = new javax.swing.JComboBox();
        jCheckBoxOpponentHandShown1 = new javax.swing.JCheckBox();
        jCheckBoxOpponentHandShown2 = new javax.swing.JCheckBox();
        jLabel15 = new javax.swing.JLabel();
        jTextFieldAIImagePath = new javax.swing.JTextField();
        jButton12 = new javax.swing.JButton();
        jCheckBoxDontChangePanels = new javax.swing.JCheckBox();
        jCheckBoxShowTipOfDay1 = new javax.swing.JCheckBox();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jTextFieldWarningTimer = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jTextFieldSicknessAlpha = new javax.swing.JTextField();
        jTextFieldDeathAlpha = new javax.swing.JTextField();
        ThemeLabel = new javax.swing.JLabel();
        jComboBoxThemes = new javax.swing.JComboBox();
        jCheckBoxResize = new javax.swing.JCheckBox();
        jButton3 = new javax.swing.JButton();
        jTextFieldErrorTimer = new javax.swing.JTextField();
        jCheckBoxoverlappedScaling = new javax.swing.JCheckBox();
        jPanel9 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jSliderVolume = new javax.swing.JSlider();
        jLabel21 = new javax.swing.JLabel();
        jTextFieldTtileMusic = new javax.swing.JTextField();
        jButton10 = new javax.swing.JButton();
        jButton13 = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        soundMapPanel1 = new csa.config.sound.SoundMapPanel();
        jLabel22 = new javax.swing.JLabel();
        jComboBoxSoundMap = new javax.swing.JComboBox();
        jLabel16 = new javax.swing.JLabel();
        jCheckBoxPlayMusic = new javax.swing.JCheckBox();
        jCheckBoxNoSound = new javax.swing.JCheckBox();
        jPanel12 = new javax.swing.JPanel();
        jButtonSave = new javax.swing.JButton();

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Automatic"));
        jPanel3.setName("jPanel3"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 376, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 554, Short.MAX_VALUE)
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Stack stuff"));
        jPanel4.setName("jPanel4"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 460, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 564, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(4, 4, 4)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("Automation", jPanel1);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Debug"));
        jPanel5.setName("jPanel5"); // NOI18N

        jLabel8.setText("Debug level");
        jLabel8.setName("jLabel8"); // NOI18N

        jTextFieldDebugLevel.setName("jTextFieldDebugLevel"); // NOI18N

        jCheckBoxDebugWindow.setText("Debug Window in Frame");
        jCheckBoxDebugWindow.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxDebugWindow.setName("jCheckBoxDebugWindow"); // NOI18N

        jButton2.setText("Clear Debug log");
        jButton2.setName("jButton2"); // NOI18N
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jCheckBoxDebugTiming.setText("Add Timing Info");
        jCheckBoxDebugTiming.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxDebugTiming.setName("jCheckBoxDebugTiming"); // NOI18N

        jTextFieldFiles.setName("jTextFieldFiles"); // NOI18N

        jTextFieldClasses.setName("jTextFieldClasses"); // NOI18N

        jTextFieldMethods.setName("jTextFieldMethods"); // NOI18N

        jLabel10.setText("Only Files");
        jLabel10.setName("jLabel10"); // NOI18N

        jLabel11.setText("Only Classes");
        jLabel11.setName("jLabel11"); // NOI18N

        jLabel12.setText("Only Methods");
        jLabel12.setName("jLabel12"); // NOI18N

        jCheckBoxDebugOff.setText("Debug Off");
        jCheckBoxDebugOff.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxDebugOff.setName("jCheckBoxDebugOff"); // NOI18N

        jCheckBoxDebugFileOnly.setText("Debug in File only");
        jCheckBoxDebugFileOnly.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxDebugFileOnly.setName("jCheckBoxDebugFileOnly"); // NOI18N

        jButton5.setText("Clear log");
        jButton5.setName("jButton5"); // NOI18N
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jCheckBoxDisableFileLogging.setText("Disable file logging");
        jCheckBoxDisableFileLogging.setToolTipText("No logging to disk, neither debug nor log.");
        jCheckBoxDisableFileLogging.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxDisableFileLogging.setName("jCheckBoxDisableFileLogging"); // NOI18N

        jCheckBoxInfoInPanel.setText("Show Debug/Log in game info panel");
        jCheckBoxInfoInPanel.setToolTipText("No logging to disk, neither debug nor log.");
        jCheckBoxInfoInPanel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxInfoInPanel.setName("jCheckBoxInfoInPanel"); // NOI18N

        jCheckBoxAutoSave.setText("Auto save");
        jCheckBoxAutoSave.setToolTipText("");
        jCheckBoxAutoSave.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxAutoSave.setName("jCheckBoxAutoSave"); // NOI18N

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jTextFieldDebugLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBoxDebugOff)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBoxDebugFileOnly))
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jCheckBoxDebugTiming, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jCheckBoxDebugWindow, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jButton5, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jTextFieldClasses, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jTextFieldMethods, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
                        .addComponent(jTextFieldFiles, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jCheckBoxDisableFileLogging, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jCheckBoxInfoInPanel, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jCheckBoxAutoSave, javax.swing.GroupLayout.Alignment.TRAILING)))
                .addContainerGap(500, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldDebugLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jCheckBoxDebugOff)
                    .addComponent(jCheckBoxDebugFileOnly))
                .addGap(4, 4, 4)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldFiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldClasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldMethods, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBoxDebugTiming)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBoxDebugWindow)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton5)
                .addGap(18, 18, 18)
                .addComponent(jCheckBoxDisableFileLogging)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBoxInfoInPanel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBoxAutoSave)
                .addContainerGap(295, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Debug", jPanel5);

        jPanel6.setName("jPanel6"); // NOI18N

        jCheckBoxScriptCache.setText("Use script cache");
        jCheckBoxScriptCache.setToolTipText("<html>\nIf script cache is switched on, game will be a bit faster overall.<BR>\nIf you script new cards or AI, you may have to reset the cache manually<BR>\nfor the new scripts to be active.\n</html>"); // NOI18N
        jCheckBoxScriptCache.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxScriptCache.setName("jCheckBoxScriptCache"); // NOI18N
        jCheckBoxScriptCache.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxScriptCacheActionPerformed(evt);
            }
        });

        jTextFieldScriptCache.setEnabled(false);
        jTextFieldScriptCache.setName("jTextFieldScriptCache"); // NOI18N

        jButtonScriptCache.setText("Reset Cache");
        jButtonScriptCache.setName("jButtonScriptCache"); // NOI18N
        jButtonScriptCache.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonScriptCacheActionPerformed(evt);
            }
        });

        jButtonImageCache.setText("Reset Cache");
        jButtonImageCache.setName("jButtonImageCache"); // NOI18N
        jButtonImageCache.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonImageCacheActionPerformed(evt);
            }
        });

        jLabel5.setText("Images in Cache");
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel9.setText("Scripts in Cache");
        jLabel9.setName("jLabel9"); // NOI18N

        jTextFieldImageCache.setEnabled(false);
        jTextFieldImageCache.setName("jTextFieldImageCache"); // NOI18N

        jLabel17.setText("FX in Cache");
        jLabel17.setName("jLabel17"); // NOI18N

        jTextFieldFXCache1.setEnabled(false);
        jTextFieldFXCache1.setName("jTextFieldFXCache1"); // NOI18N

        jButtonFXCache.setText("Reset Cache");
        jButtonFXCache.setName("jButtonFXCache"); // NOI18N
        jButtonFXCache.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonFXCacheActionPerformed(evt);
            }
        });

        jLabel18.setText("Only caching for clips!");
        jLabel18.setName("jLabel18"); // NOI18N

        jButtonHintsCache.setText("Reset Cache");
        jButtonHintsCache.setName("jButtonHintsCache"); // NOI18N
        jButtonHintsCache.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonHintsCacheActionPerformed(evt);
            }
        });

        jTextFieldHintsCache.setEnabled(false);
        jTextFieldHintsCache.setName("jTextFieldHintsCache"); // NOI18N

        jLabel31.setText("Hints in Cache");
        jLabel31.setName("jLabel31"); // NOI18N

        jButtonCacheWatch.setText("Cache Watch");
        jButtonCacheWatch.setName("jButtonCacheWatch"); // NOI18N
        jButtonCacheWatch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCacheWatchActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel31, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldHintsCache, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldScriptCache, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jTextFieldFXCache1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jTextFieldImageCache, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonHintsCache)
                    .addComponent(jButtonScriptCache)
                    .addComponent(jButtonFXCache)
                    .addComponent(jButtonImageCache))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel18)
                    .addComponent(jCheckBoxScriptCache)
                    .addComponent(jButtonCacheWatch))
                .addContainerGap(501, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jButtonImageCache)
                    .addComponent(jTextFieldImageCache, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonCacheWatch))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jButtonFXCache)
                    .addComponent(jLabel18)
                    .addComponent(jTextFieldFXCache1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldScriptCache, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(jButtonScriptCache)
                    .addComponent(jCheckBoxScriptCache))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31)
                    .addComponent(jButtonHintsCache)
                    .addComponent(jTextFieldHintsCache, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(475, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Cache & Co", jPanel6);

        jPanel7.setName("jPanel7"); // NOI18N

        jCheckBoxFirstTime.setText("First time in game");
        jCheckBoxFirstTime.setToolTipText("If changed to true, the next time the game is started, the introduction-help will be displayed again.");
        jCheckBoxFirstTime.setName("jCheckBoxFirstTime"); // NOI18N

        jCheckBox1.setText("Remember last player");
        jCheckBox1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jCheckBox1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jCheckBox1.setName("jCheckBox1"); // NOI18N

        jTextField1.setName("jTextField1"); // NOI18N

        jLabel23.setText("Last player");
        jLabel23.setName("jLabel23"); // NOI18N

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jCheckBox1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel23))
                    .addComponent(jCheckBoxFirstTime))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(522, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jCheckBoxFirstTime)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(535, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Player related", jPanel7);

        jPanel8.setName("jPanel8"); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Display"));
        jPanel2.setName("jPanel2"); // NOI18N

        jCheckBoxStartInFullscrren.setText("Start in Fullscreen");
        jCheckBoxStartInFullscrren.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxStartInFullscrren.setName("jCheckBoxStartInFullscrren"); // NOI18N

        jLabel13.setText("Screen mode");
        jLabel13.setName("jLabel13"); // NOI18N

        jComboBoxScreenModes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBoxScreenModes.setName("jComboBoxScreenModes"); // NOI18N

        jCheckBoxOpponentHandShown1.setText("Game back Image");
        jCheckBoxOpponentHandShown1.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxOpponentHandShown1.setName("jCheckBoxOpponentHandShown1"); // NOI18N

        jCheckBoxOpponentHandShown2.setText("Only in fullscreen");
        jCheckBoxOpponentHandShown2.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxOpponentHandShown2.setName("jCheckBoxOpponentHandShown2"); // NOI18N

        jLabel15.setText("Image");
        jLabel15.setName("jLabel15"); // NOI18N

        jTextFieldAIImagePath.setToolTipText("Image path Info");
        jTextFieldAIImagePath.setName("jTextFieldAIImagePath"); // NOI18N

        jButton12.setText("...");
        jButton12.setMargin(new java.awt.Insets(0, 1, 0, -1));
        jButton12.setName("jButton12"); // NOI18N
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        jCheckBoxDontChangePanels.setText("Don`t back change panels");
        jCheckBoxDontChangePanels.setToolTipText("If coloring on some Linux (Debian, Ubuntu...) looks bad. try this switch..."); // NOI18N
        jCheckBoxDontChangePanels.setName("jCheckBoxDontChangePanels"); // NOI18N

        jCheckBoxShowTipOfDay1.setText("Show Tip of day");
        jCheckBoxShowTipOfDay1.setName("jCheckBoxShowTipOfDay1"); // NOI18N

        jLabel24.setText("Error timer");
        jLabel24.setName("jLabel24"); // NOI18N

        jLabel25.setText("Warning timer");
        jLabel25.setName("jLabel25"); // NOI18N

        jTextFieldWarningTimer.setToolTipText("How long the little yellow flash tex for an warning message will be shown in milliseconds");
        jTextFieldWarningTimer.setName("jTextFieldWarningTimer"); // NOI18N

        jLabel26.setText("Death image alpha");
        jLabel26.setName("jLabel26"); // NOI18N

        jLabel27.setText("Sickness image alpha");
        jLabel27.setName("jLabel27"); // NOI18N

        jTextFieldSicknessAlpha.setToolTipText("");
        jTextFieldSicknessAlpha.setName("jTextFieldSicknessAlpha"); // NOI18N

        jTextFieldDeathAlpha.setToolTipText("");
        jTextFieldDeathAlpha.setName("jTextFieldDeathAlpha"); // NOI18N

        ThemeLabel.setText("Theme");
        ThemeLabel.setName("ThemeLabel"); // NOI18N

        jComboBoxThemes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBoxThemes.setName("jComboBoxThemes"); // NOI18N

        jCheckBoxResize.setText("Resize to fit");
        jCheckBoxResize.setName("jCheckBoxResize"); // NOI18N

        jButton3.setText("Config Theme");
        jButton3.setName("jButton3"); // NOI18N
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jTextFieldErrorTimer.setToolTipText("How long the BIG RED flash tex for an error message will be shown in milliseconds");
        jTextFieldErrorTimer.setName("jTextFieldErrorTimer"); // NOI18N

        jCheckBoxoverlappedScaling.setSelected(true);
        jCheckBoxoverlappedScaling.setText("Overlapped scaling");
        jCheckBoxoverlappedScaling.setToolTipText("To take effect scaled objects must be \"somehow\" redrawn! - No auto update!");
        jCheckBoxoverlappedScaling.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jCheckBoxoverlappedScaling.setName("jCheckBoxoverlappedScaling"); // NOI18N
        jCheckBoxoverlappedScaling.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxoverlappedScalingActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addGap(90, 90, 90)
                                        .addComponent(ThemeLabel))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                        .addGap(62, 62, 62)
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jLabel13)
                                            .addComponent(jLabel15))))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jTextFieldAIImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton12))
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jComboBoxThemes, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jComboBoxScreenModes, javax.swing.GroupLayout.Alignment.LEADING, 0, 177, Short.MAX_VALUE)))
                                .addGap(28, 28, 28))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jCheckBoxoverlappedScaling)
                                .addGap(204, 204, 204)))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jButton3)
                                .addGap(158, 158, 158))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jCheckBoxDontChangePanels)
                                    .addComponent(jCheckBoxShowTipOfDay1)
                                    .addComponent(jCheckBoxResize))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 177, Short.MAX_VALUE)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel24, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel26, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel27, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jTextFieldWarningTimer, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                                    .addComponent(jTextFieldDeathAlpha, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextFieldSicknessAlpha, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE)
                                    .addComponent(jTextFieldErrorTimer, javax.swing.GroupLayout.Alignment.LEADING)))))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jCheckBoxStartInFullscrren, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jCheckBoxOpponentHandShown2, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jCheckBoxOpponentHandShown1, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 683, Short.MAX_VALUE)))
                .addGap(19, 19, 19))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap(20, Short.MAX_VALUE)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jCheckBoxShowTipOfDay1)
                            .addComponent(jLabel24)
                            .addComponent(jTextFieldErrorTimer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jCheckBoxoverlappedScaling)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBoxOpponentHandShown1)
                    .addComponent(jCheckBoxDontChangePanels)
                    .addComponent(jLabel25)
                    .addComponent(jTextFieldWarningTimer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(jCheckBoxOpponentHandShown2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(jTextFieldAIImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCheckBoxResize)
                            .addComponent(jButton12)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(46, 46, 46)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel26)
                            .addComponent(jTextFieldDeathAlpha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(14, 14, 14)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(jComboBoxScreenModes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27)
                    .addComponent(jTextFieldSicknessAlpha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBoxStartInFullscrren)
                .addGap(9, 9, 9)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ThemeLabel)
                    .addComponent(jComboBoxThemes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3))
                .addGap(27, 27, 27))
        );

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(315, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Visuals", jPanel8);

        jPanel9.setName("jPanel9"); // NOI18N

        jLabel14.setText("Sound Volumne");
        jLabel14.setName("jLabel14"); // NOI18N

        jSliderVolume.setMajorTickSpacing(20);
        jSliderVolume.setMinorTickSpacing(5);
        jSliderVolume.setPaintLabels(true);
        jSliderVolume.setPaintTicks(true);
        jSliderVolume.setSnapToTicks(true);
        jSliderVolume.setValue(100);
        jSliderVolume.setName("jSliderVolume"); // NOI18N
        jSliderVolume.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSliderVolumeStateChanged(evt);
            }
        });

        jLabel21.setText("Title music");
        jLabel21.setName("jLabel21"); // NOI18N

        jTextFieldTtileMusic.setToolTipText("Image path Info");
        jTextFieldTtileMusic.setName("jTextFieldTtileMusic"); // NOI18N

        jButton10.setText("...");
        jButton10.setName("jButton10"); // NOI18N
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        jButton13.setText("!");
        jButton13.setMargin(new java.awt.Insets(0, 2, 0, 1));
        jButton13.setName("jButton13"); // NOI18N
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Sound map"));
        jPanel10.setName("jPanel10"); // NOI18N

        soundMapPanel1.setName("soundMapPanel1"); // NOI18N

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 827, Short.MAX_VALUE)
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(soundMapPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 807, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 456, Short.MAX_VALUE)
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(soundMapPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE)
                    .addContainerGap()))
        );

        jLabel22.setText("Sound map");
        jLabel22.setName("jLabel22"); // NOI18N

        jComboBoxSoundMap.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBoxSoundMap.setName("jComboBoxSoundMap"); // NOI18N

        jLabel16.setText("<html>FX-Caching:<b> see Cache & Co</b></html>"); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        jCheckBoxPlayMusic.setSelected(true);
        jCheckBoxPlayMusic.setText("Play");
        jCheckBoxPlayMusic.setName("jCheckBoxPlayMusic"); // NOI18N

        jCheckBoxNoSound.setText("No Sound");
        jCheckBoxNoSound.setName("jCheckBoxNoSound"); // NOI18N

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jCheckBoxNoSound, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(29, 29, 29)
                                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel21)
                                    .addComponent(jLabel22))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jTextFieldTtileMusic, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jComboBoxSoundMap, javax.swing.GroupLayout.Alignment.TRAILING, 0, 131, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel9Layout.createSequentialGroup()
                                        .addComponent(jButton10)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton13)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jCheckBoxPlayMusic))))
                            .addComponent(jSliderVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(37, 37, 37))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                        .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(jLabel21)
                    .addComponent(jTextFieldTtileMusic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton10)
                    .addComponent(jButton13)
                    .addComponent(jCheckBoxPlayMusic)
                    .addComponent(jCheckBoxNoSound))
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSliderVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel22)
                            .addComponent(jComboBoxSoundMap, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Sound stuff", jPanel9);

        jPanel12.setName("jPanel12"); // NOI18N

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 860, Short.MAX_VALUE)
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 585, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("Rules", jPanel12);

        jButtonSave.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jButtonSave.setText("Save Configuration");
        jButtonSave.setName("jButtonSave"); // NOI18N
        jButtonSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSaveActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonSave)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 864, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jButtonSave)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 609, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed

        readAllToCurrent();
        Configuration.getConfiguration().save();
        setAllFromCurrent();

}//GEN-LAST:event_jButtonSaveActionPerformed

    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton13ActionPerformed
    {//GEN-HEADEREND:event_jButton13ActionPerformed
        String path = jTextFieldTtileMusic.getText();
        if (path.length() == 0) return;
        try
        {
            csa.sound.Audio.play(csa.util.UtilityString.cleanFileString(path));
        }
        catch (Throwable e)
        {}
}//GEN-LAST:event_jButton13ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton10ActionPerformed
    {//GEN-HEADEREND:event_jButton10ActionPerformed

        InternalFrameFileChoser fc = new csa.gui.dialogs.InternalFrameFileChoser();
        fc.setCurrentDirectory(new java.io.File("sound"));

        int r = fc.showOpenDialog(Configuration.getConfiguration().getMainFrame());
        if (r != InternalFrameFileChoser.APPROVE_OPTION) return;
        String fullPath = fc.getSelectedFile().getAbsolutePath();
        jTextFieldTtileMusic.setText(csa.util.UtilityString.makeRelative(fullPath));
}//GEN-LAST:event_jButton10ActionPerformed

    private void jSliderVolumeStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_jSliderVolumeStateChanged
    {//GEN-HEADEREND:event_jSliderVolumeStateChanged
        csa.sound.Audio.setAllVolumne(jSliderVolume.getValue());
}//GEN-LAST:event_jSliderVolumeStateChanged

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton12ActionPerformed
    {//GEN-HEADEREND:event_jButton12ActionPerformed

        //        Configuration.getConfiguration().showFileChooserDialog("1", "2");
        InternalFrameFileChoser fc = new csa.gui.dialogs.InternalFrameFileChoser();
        fc.setCurrentDirectory(new java.io.File("images"));
        int r = fc.showOpenDialog(Configuration.getConfiguration().getMainFrame());
        if (r != InternalFrameFileChoser.APPROVE_OPTION) return;
        String fullPath = fc.getSelectedFile().getPath();
        // Configuration.getConfiguration().setBackImagePath(fullPath);
        jTextFieldAIImagePath.setText(fullPath);
}//GEN-LAST:event_jButton12ActionPerformed

    private void jButtonFXCacheActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonFXCacheActionPerformed
    {//GEN-HEADEREND:event_jButtonFXCacheActionPerformed
        PlayClip.resetCache();
        jTextFieldFXCache1.setText(""+PlayClip.mClipMap.size());
}//GEN-LAST:event_jButtonFXCacheActionPerformed

    private void jButtonImageCacheActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonImageCacheActionPerformed
    {//GEN-HEADEREND:event_jButtonImageCacheActionPerformed
        jTextFieldImageCache.setText(""+0);
}//GEN-LAST:event_jButtonImageCacheActionPerformed

    private void jButtonScriptCacheActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonScriptCacheActionPerformed
    {//GEN-HEADEREND:event_jButtonScriptCacheActionPerformed
        Configuration C = Configuration.getConfiguration();
        jTextFieldScriptCache.setText("0");
}//GEN-LAST:event_jButtonScriptCacheActionPerformed

    private void jCheckBoxScriptCacheActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jCheckBoxScriptCacheActionPerformed
    {//GEN-HEADEREND:event_jCheckBoxScriptCacheActionPerformed
        Configuration C = Configuration.getConfiguration();
    }//GEN-LAST:event_jCheckBoxScriptCacheActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton5ActionPerformed
    {//GEN-HEADEREND:event_jButton5ActionPerformed
        Configuration C = Configuration.getConfiguration();
        C.clearLog();
}//GEN-LAST:event_jButton5ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton2ActionPerformed
    {//GEN-HEADEREND:event_jButton2ActionPerformed

        Configuration C = Configuration.getConfiguration();
        C.clearDebugLog();
}//GEN-LAST:event_jButton2ActionPerformed

    private void jButtonHintsCacheActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonHintsCacheActionPerformed
    {//GEN-HEADEREND:event_jButtonHintsCacheActionPerformed
    }//GEN-LAST:event_jButtonHintsCacheActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        if (jComboBoxThemes.getSelectedIndex()==-1) return;
        String name = jComboBoxThemes.getSelectedItem().toString();
        if (name.trim().length()==0) return;
        ThemeDataPanel panel = new ThemeDataPanel(name.trim());
        mParent.showPanelModal(panel, "Theme config", 600, 400);
    }//GEN-LAST:event_jButton3ActionPerformed

    ImageCacheWatchFrame imageCacheWatchFrame=null;
    private void jButtonCacheWatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCacheWatchActionPerformed
        
        if (imageCacheWatchFrame==null)
            imageCacheWatchFrame = new ImageCacheWatchFrame();
        imageCacheWatchFrame.setVisible(true);
    }//GEN-LAST:event_jButtonCacheWatchActionPerformed

    private void jCheckBoxoverlappedScalingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxoverlappedScalingActionPerformed
        if (mClassSetting>0) return;
        Scaler.overlappedScaling = jCheckBoxoverlappedScaling.isSelected();
        ImageCache.clearCache();


    }//GEN-LAST:event_jCheckBoxoverlappedScalingActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel ThemeLabel;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButtonCacheWatch;
    private javax.swing.JButton jButtonFXCache;
    private javax.swing.JButton jButtonHintsCache;
    private javax.swing.JButton jButtonImageCache;
    private javax.swing.JButton jButtonSave;
    private javax.swing.JButton jButtonScriptCache;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBoxAutoSave;
    private javax.swing.JCheckBox jCheckBoxDebugFileOnly;
    private javax.swing.JCheckBox jCheckBoxDebugOff;
    private javax.swing.JCheckBox jCheckBoxDebugTiming;
    private javax.swing.JCheckBox jCheckBoxDebugWindow;
    private javax.swing.JCheckBox jCheckBoxDisableFileLogging;
    private javax.swing.JCheckBox jCheckBoxDontChangePanels;
    private javax.swing.JCheckBox jCheckBoxFirstTime;
    private javax.swing.JCheckBox jCheckBoxInfoInPanel;
    private javax.swing.JCheckBox jCheckBoxNoSound;
    private javax.swing.JCheckBox jCheckBoxOpponentHandShown1;
    private javax.swing.JCheckBox jCheckBoxOpponentHandShown2;
    private javax.swing.JCheckBox jCheckBoxPlayMusic;
    private javax.swing.JCheckBox jCheckBoxResize;
    private javax.swing.JCheckBox jCheckBoxScriptCache;
    private javax.swing.JCheckBox jCheckBoxShowTipOfDay1;
    private javax.swing.JCheckBox jCheckBoxStartInFullscrren;
    private javax.swing.JCheckBox jCheckBoxoverlappedScaling;
    private javax.swing.JComboBox jComboBoxScreenModes;
    private javax.swing.JComboBox jComboBoxSoundMap;
    private javax.swing.JComboBox jComboBoxThemes;
    private javax.swing.JLabel jLabel10;
    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 jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JSlider jSliderVolume;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextFieldAIImagePath;
    private javax.swing.JTextField jTextFieldClasses;
    private javax.swing.JTextField jTextFieldDeathAlpha;
    private javax.swing.JTextField jTextFieldDebugLevel;
    private javax.swing.JTextField jTextFieldErrorTimer;
    private javax.swing.JTextField jTextFieldFXCache1;
    private javax.swing.JTextField jTextFieldFiles;
    private javax.swing.JTextField jTextFieldHintsCache;
    private javax.swing.JTextField jTextFieldImageCache;
    private javax.swing.JTextField jTextFieldMethods;
    private javax.swing.JTextField jTextFieldScriptCache;
    private javax.swing.JTextField jTextFieldSicknessAlpha;
    private javax.swing.JTextField jTextFieldTtileMusic;
    private javax.swing.JTextField jTextFieldWarningTimer;
    private csa.config.sound.SoundMapPanel soundMapPanel1;
    // End of variables declaration//GEN-END:variables

    private void setScreenModes()
    {
        jComboBoxScreenModes.removeAllItems();
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] devices = env.getScreenDevices();
        DisplayMode[] modes = devices[0].getDisplayModes();

        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            jComboBoxScreenModes.addItem(m);
        }
    }

    public static DisplayMode getDisplayModeForString(String s)
    {
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] devices = env.getScreenDevices();
        DisplayMode[] modes = devices[0].getDisplayModes();

        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if (s.equals(m)) return displayMode;
        }

        // default to something senseable, taken first mode with res of 1024width
        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if ((displayMode.getWidth()==1024) && (displayMode.getBitDepth() == 32))
            {
                return displayMode;
            }
        }
        // default to something senseable, taken first mode with res of 1024width
        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if ((displayMode.getWidth()==1024) && (displayMode.getBitDepth() == 16))
            {
                return displayMode;
            }
        }
        // default to something senseable, taken first mode with res of 1024width
        for (int i = 0; i < modes.length; i++)
        {
            DisplayMode displayMode = modes[i];
            String m = "";
            m+= displayMode.getWidth()+"x";
            m+= displayMode.getHeight()+" ";
            m+= displayMode.getBitDepth()+"bit ";
            m+= displayMode.getRefreshRate()+"Hz";
            if ((displayMode.getWidth()==1024) && (displayMode.getBitDepth() == 8))
            {
                return displayMode;
            }
        }
        return null;
    }

    String buildStringForMode(DisplayMode displayMode)
    {
        String m = "";
        if (displayMode == null) return m;
        m+= displayMode.getWidth()+"x";
        m+= displayMode.getHeight()+" ";
        m+= displayMode.getBitDepth()+"bit ";
        m+= displayMode.getRefreshRate()+"Hz";
        return m;
    }
    
    private void correctScreenModeIfNeccessary()
    {
        Configuration C = Configuration.getConfiguration();
        C.setFullScrrenResString(buildStringForMode(getDisplayModeForString(C.getFullScrrenResString())));
    }
}
