Package xplanetconfigurator.gui

Source Code of xplanetconfigurator.gui.JPanelControlParametersSimpleConfiguration

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

/*
* JPanelAll.java
*
* Created on 27.04.2009, 22:13:10
*/
package xplanetconfigurator.gui;

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.text.JTextComponent;
import xplanetconfigurator.util.FileUtil;
import xplanetconfigurator.util.XPlanetRessourceFinder;

/**
*
* @author tom
*/
public class JPanelControlParametersSimpleConfiguration extends ControlPanel {

    private Logger logger;
    private List originNames;
    private List targetNames;
    private List exampleConfigurations;
    private final String NAME_CHANGED = "Changed";

    /** Creates new form JPanelAll */
    public JPanelControlParametersSimpleConfiguration(MainFrame mainFrame) {
        super(mainFrame);
        initComponents();
        this.logger = Logger.getLogger(this.getClass().getName());
        this.fillComponents();
        // Set the default values
        // TODO: Read the
    }

    /** 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() {
        java.awt.GridBagConstraints gridBagConstraints;

        buttonGroupOrigin = new javax.swing.ButtonGroup();
        jPanelMain = new javax.swing.JPanel();
        jPanelControls = new javax.swing.JPanel();
        jPanelFromAt = new javax.swing.JPanel();
        jPanelTarget = new javax.swing.JPanel();
        jLabelTarget = new javax.swing.JLabel();
        jComboBoxTarget = new javax.swing.JComboBox();
        jPanelMagniificaton = new javax.swing.JPanel();
        jLabelMagnify = new javax.swing.JLabel();
        jSliderMagnification = new javax.swing.JSlider();
        jPanelOrigin = new javax.swing.JPanel();
        jLabelOriginDecision = new javax.swing.JLabel();
        jSliderLatitude = new javax.swing.JSlider();
        jPanelOriginDecision = new javax.swing.JPanel();
        jRadioButtonOtherBody = new javax.swing.JRadioButton();
        jRadioButtonPositionOverBody = new javax.swing.JRadioButton();
        jComboBoxOrigin = new javax.swing.JComboBox();
        jSliderLongitude = new javax.swing.JSlider();
        jPanelExamples = new javax.swing.JPanel();
        jLabelSuggestions = new javax.swing.JLabel();
        jComboBoxSuggestions = new javax.swing.JComboBox();
        jPanelWhatElseToShow = new javax.swing.JPanel();
        jCheckBoxLabel = new javax.swing.JCheckBox();
        jPanelStars = new javax.swing.JPanel();
        jCheckBoxShowStars = new javax.swing.JCheckBox();
        jCheckBoxLabelStars = new javax.swing.JCheckBox();
        jCheckBoxArcs = new javax.swing.JCheckBox();
        jPanelEarth = new javax.swing.JPanel();
        jCheckBoxClouds = new javax.swing.JCheckBox();
        jCheckBoxVolcanos = new javax.swing.JCheckBox();
        jCheckBoxEarthQuakes = new javax.swing.JCheckBox();
        jCheckBoxISS = new javax.swing.JCheckBox();
        jCheckBoxStorms = new javax.swing.JCheckBox();
        jPanelMore = new javax.swing.JPanel();
        jComboBoxVerbosity = new javax.swing.JComboBox();
        jLabelBodyVerbosity = new javax.swing.JLabel();
        jLabelTime = new javax.swing.JLabel();
        jTextFieldTime = new javax.swing.JTextField();
        jPanelControlsAtRightSide = new javax.swing.JPanel();
        jPanelSizeOnScreeFOV = new javax.swing.JPanel();
        jPanelDistanceSizeFOV = new javax.swing.JPanel();
        jLabelDistance = new javax.swing.JLabel();
        jSliderDistance = new javax.swing.JSlider();
        jLabelSizeOnScreen = new javax.swing.JLabel();
        jSliderSizeOnScreen = new javax.swing.JSlider();
        jPanelButtons = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();

        setMinimumSize(new java.awt.Dimension(950, 430));
        setPreferredSize(new java.awt.Dimension(950, 430));
        setLayout(new java.awt.GridBagLayout());

        jPanelMain.setMinimumSize(null);
        jPanelMain.setName("jPanelMain"); // NOI18N
        jPanelMain.setPreferredSize(null);
        jPanelMain.setLayout(new java.awt.GridBagLayout());

        jPanelControls.setMinimumSize(null);
        jPanelControls.setName("jPanelControls"); // NOI18N
        jPanelControls.setPreferredSize(null);
        jPanelControls.setLayout(new java.awt.GridBagLayout());

        jPanelFromAt.setBorder(javax.swing.BorderFactory.createTitledBorder("Where do you want to look at ?"));
        jPanelFromAt.setName("jPanelFromAt"); // NOI18N
        jPanelFromAt.setLayout(new java.awt.GridBagLayout());

        jPanelTarget.setBorder(javax.swing.BorderFactory.createTitledBorder("Looking at"));
        jPanelTarget.setName("jPanelTarget"); // NOI18N
        jPanelTarget.setLayout(new java.awt.GridBagLayout());

        jLabelTarget.setText("Celestial Body"); // NOI18N
        jLabelTarget.setName("jLabelTarget"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
        jPanelTarget.add(jLabelTarget, gridBagConstraints);

        jComboBoxTarget.setToolTipText("<html>This is the celestial Body you will look at");
        jComboBoxTarget.setName("jComboBoxTarget"); // NOI18N
        jComboBoxTarget.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTargetActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        jPanelTarget.add(jComboBoxTarget, gridBagConstraints);

        jPanelMagniificaton.setName("jPanelMagniificaton"); // NOI18N
        jPanelMagniificaton.setLayout(new java.awt.GridBagLayout());

        jLabelMagnify.setText("<html>Magnify"); // NOI18N
        jLabelMagnify.setName("jLabelMagnify"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.insets = new java.awt.Insets(7, 0, 0, 5);
        jPanelMagniificaton.add(jLabelMagnify, gridBagConstraints);

        jSliderMagnification.setMajorTickSpacing(20);
        jSliderMagnification.setMaximum(60);
        jSliderMagnification.setMinorTickSpacing(5);
        jSliderMagnification.setPaintLabels(true);
        jSliderMagnification.setPaintTicks(true);
        jSliderMagnification.setSnapToTicks(true);
        jSliderMagnification.setToolTipText("<html>Draws the celestial Bodies bigger");
        jSliderMagnification.setName("jSliderMagnification"); // NOI18N
        jSliderMagnification.setPreferredSize(new java.awt.Dimension(36, 45));
        jSliderMagnification.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jSliderMagnificationMouseReleased(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(7, 0, 0, 0);
        jPanelMagniificaton.add(jSliderMagnification, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanelTarget.add(jPanelMagniificaton, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        jPanelFromAt.add(jPanelTarget, gridBagConstraints);

        jPanelOrigin.setBorder(javax.swing.BorderFactory.createTitledBorder("Looking from"));
        jPanelOrigin.setName("jPanelOrigin"); // NOI18N
        jPanelOrigin.setLayout(new java.awt.GridBagLayout());

        jLabelOriginDecision.setText("Decide from where to look at the Body"); // NOI18N
        jLabelOriginDecision.setName("jLabelOriginDecision"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
        jPanelOrigin.add(jLabelOriginDecision, gridBagConstraints);

        jSliderLatitude.setMajorTickSpacing(45);
        jSliderLatitude.setMaximum(90);
        jSliderLatitude.setMinimum(-90);
        jSliderLatitude.setMinorTickSpacing(10);
        jSliderLatitude.setOrientation(javax.swing.JSlider.VERTICAL);
        jSliderLatitude.setPaintLabels(true);
        jSliderLatitude.setPaintTicks(true);
        jSliderLatitude.setSnapToTicks(true);
        jSliderLatitude.setToolTipText("<html>Latitude<br>Position over Target<br>Direction North-South");
        jSliderLatitude.setName("jSliderLatitude"); // NOI18N
        jSliderLatitude.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jSliderLatitudeMouseReleased(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        jPanelOrigin.add(jSliderLatitude, gridBagConstraints);

        jPanelOriginDecision.setName("jPanelOriginDecision"); // NOI18N
        jPanelOriginDecision.setLayout(new java.awt.GridBagLayout());

        buttonGroupOrigin.add(jRadioButtonOtherBody);
        jRadioButtonOtherBody.setText("Another Body"); // NOI18N
        jRadioButtonOtherBody.setName("jRadioButtonOtherBody"); // NOI18N
        jRadioButtonOtherBody.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonOtherBodyActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(7, 0, 0, 0);
        jPanelOriginDecision.add(jRadioButtonOtherBody, gridBagConstraints);

        buttonGroupOrigin.add(jRadioButtonPositionOverBody);
        jRadioButtonPositionOverBody.setText("Fixed Position over Body"); // NOI18N
        jRadioButtonPositionOverBody.setToolTipText("<html>Fixed Position over the Body draw on your Screen<br> Think of a geostationary Satallite");
        jRadioButtonPositionOverBody.setName("jRadioButtonPositionOverBody"); // NOI18N
        jRadioButtonPositionOverBody.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonPositionOverBodyActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
        jPanelOriginDecision.add(jRadioButtonPositionOverBody, gridBagConstraints);

        jComboBoxOrigin.setToolTipText("<html>You will look from this celestial Body<br>\nat the 'Target' Body displayed on your Screen");
        jComboBoxOrigin.setName("jComboBoxOrigin"); // NOI18N
        jComboBoxOrigin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxOriginActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(7, 0, 0, 5);
        jPanelOriginDecision.add(jComboBoxOrigin, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
        jPanelOrigin.add(jPanelOriginDecision, gridBagConstraints);

        jSliderLongitude.setMajorTickSpacing(90);
        jSliderLongitude.setMaximum(180);
        jSliderLongitude.setMinimum(-180);
        jSliderLongitude.setMinorTickSpacing(10);
        jSliderLongitude.setPaintLabels(true);
        jSliderLongitude.setPaintTicks(true);
        jSliderLongitude.setSnapToTicks(true);
        jSliderLongitude.setToolTipText("<html>Longitude<br>Position over Target<br>Direction: East-West");
        jSliderLongitude.setMinimumSize(null);
        jSliderLongitude.setName("jSliderLongitude"); // NOI18N
        jSliderLongitude.setPreferredSize(null);
        jSliderLongitude.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jSliderLongitudeMouseReleased(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
        gridBagConstraints.weighty = 1.0;
        jPanelOrigin.add(jSliderLongitude, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        jPanelFromAt.add(jPanelOrigin, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
        jPanelControls.add(jPanelFromAt, gridBagConstraints);

        jPanelExamples.setName("jPanelExamples"); // NOI18N
        jPanelExamples.setLayout(new java.awt.GridBagLayout());

        jLabelSuggestions.setText("Example Configurations");
        jLabelSuggestions.setName("jLabelSuggestions"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 7);
        jPanelExamples.add(jLabelSuggestions, gridBagConstraints);

        jComboBoxSuggestions.setToolTipText("<html>You can use these Examples as Start<br>\nWatch this: Every Time you choose one of the Examples<br>\nin this List all your Changes will be overwritten.<br>\nStick to 'Changed' if you want to keep your Modifications.<br>\nAn Alternativ is to use 'Expert Mode'.");
        jComboBoxSuggestions.setName("jComboBoxSuggestions"); // NOI18N
        jComboBoxSuggestions.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxSuggestionsActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
        jPanelExamples.add(jComboBoxSuggestions, gridBagConstraints);

        jPanelWhatElseToShow.setBorder(javax.swing.BorderFactory.createTitledBorder("What else to show"));
        jPanelWhatElseToShow.setName("jPanelWhatElseToShow"); // NOI18N
        jPanelWhatElseToShow.setLayout(new java.awt.GridBagLayout());

        jCheckBoxLabel.setText("Draw Label");
        jCheckBoxLabel.setToolTipText("<html>Displays Text in the upper right Corner of the Screen");
        jCheckBoxLabel.setName("jCheckBoxLabel"); // NOI18N
        jCheckBoxLabel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxLabelActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        jPanelWhatElseToShow.add(jCheckBoxLabel, gridBagConstraints);

        jPanelStars.setBorder(javax.swing.BorderFactory.createTitledBorder("Stars"));
        jPanelStars.setName("jPanelStars"); // NOI18N
        jPanelStars.setLayout(new java.awt.GridBagLayout());

        jCheckBoxShowStars.setText("Brighter"); // NOI18N
        jCheckBoxShowStars.setToolTipText("<html>Draw the Stars bigger and brighter");
        jCheckBoxShowStars.setName("jCheckBoxShowStars"); // NOI18N
        jCheckBoxShowStars.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxShowStarsActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanelStars.add(jCheckBoxShowStars, gridBagConstraints);

        jCheckBoxLabelStars.setText("Labels"); // NOI18N
        jCheckBoxLabelStars.setToolTipText("<html>Display a Label for some Stars");
        jCheckBoxLabelStars.setName("jCheckBoxLabelStars"); // NOI18N
        jCheckBoxLabelStars.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxLabelStarsActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanelStars.add(jCheckBoxLabelStars, gridBagConstraints);

        jCheckBoxArcs.setText("Arcs");
        jCheckBoxArcs.setToolTipText("<html>Draw Arcs between some Stars");
        jCheckBoxArcs.setName("jCheckBoxArcs"); // NOI18N
        jCheckBoxArcs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxArcsActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanelStars.add(jCheckBoxArcs, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        jPanelWhatElseToShow.add(jPanelStars, gridBagConstraints);

        jPanelEarth.setBorder(javax.swing.BorderFactory.createTitledBorder("Earth (includes regular downloads)"));
        jPanelEarth.setName("jPanelEarth"); // NOI18N
        jPanelEarth.setLayout(new java.awt.GridBagLayout());

        jCheckBoxClouds.setText("Clouds"); // NOI18N
        jCheckBoxClouds.setToolTipText("<html>Show Clouds<br>The Cloud Map is downloaded every 3 Hours");
        jCheckBoxClouds.setName("jCheckBoxClouds"); // NOI18N
        jCheckBoxClouds.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxCloudsActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
        jPanelEarth.add(jCheckBoxClouds, gridBagConstraints);

        jCheckBoxVolcanos.setText("Volcanos"); // NOI18N
        jCheckBoxVolcanos.setToolTipText("<html>Show acitive Volcanos<br>The 'Marker File' is downloaded every 3 Hours");
        jCheckBoxVolcanos.setName("jCheckBoxVolcanos"); // NOI18N
        jCheckBoxVolcanos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxVolcanosActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
        jPanelEarth.add(jCheckBoxVolcanos, gridBagConstraints);

        jCheckBoxEarthQuakes.setText("Earth Quakes"); // NOI18N
        jCheckBoxEarthQuakes.setToolTipText("<html>Show recent Earth Quakes<br>The 'Marker File' is downloaded every 3 Hours");
        jCheckBoxEarthQuakes.setName("jCheckBoxEarthQuakes"); // NOI18N
        jCheckBoxEarthQuakes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxEarthQuakesActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
        jPanelEarth.add(jCheckBoxEarthQuakes, gridBagConstraints);

        jCheckBoxISS.setText("ISS"); // NOI18N
        jCheckBoxISS.setToolTipText("<html>Show the International Space Station<br>\nIt does not work at the Moment");
        jCheckBoxISS.setName("jCheckBoxISS"); // NOI18N
        jCheckBoxISS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxISSActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanelEarth.add(jCheckBoxISS, gridBagConstraints);

        jCheckBoxStorms.setText("Storms"); // NOI18N
        jCheckBoxStorms.setToolTipText("<html>Shows the Tracks of acitive Storms<br>The 'Marker File' is downloaded every 3 Hours");
        jCheckBoxStorms.setName("jCheckBoxStorms"); // NOI18N
        jCheckBoxStorms.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxStormsActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
        jPanelEarth.add(jCheckBoxStorms, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(7, 0, 0, 5);
        jPanelWhatElseToShow.add(jPanelEarth, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 5);
        jPanelExamples.add(jPanelWhatElseToShow, gridBagConstraints);

        jPanelMore.setBorder(javax.swing.BorderFactory.createTitledBorder("More"));
        jPanelMore.setName("jPanelMore"); // NOI18N
        jPanelMore.setLayout(new java.awt.GridBagLayout());

        jComboBoxVerbosity.setToolTipText("<html>Verbosity of XPlanet<br>\nXPlanet is the Programm behind the Scenes<br>\nIt does all the Work: Calculations, Renderings,...<br>\nThe higher the Number in List the more Messages<br>\nXPlanet displays.");
        jComboBoxVerbosity.setName("jComboBoxVerbosity"); // NOI18N
        jComboBoxVerbosity.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxVerbosityActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
        jPanelMore.add(jComboBoxVerbosity, gridBagConstraints);

        jLabelBodyVerbosity.setText("Verbosity of XPlanets Computations"); // NOI18N
        jLabelBodyVerbosity.setName("jLabelBodyVerbosity"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 7);
        jPanelMore.add(jLabelBodyVerbosity, gridBagConstraints);

        jLabelTime.setText("Travel in Time to [YYYYMMDD.HHMMSS]");
        jLabelTime.setName("jLabelTime"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 7);
        jPanelMore.add(jLabelTime, gridBagConstraints);

        jTextFieldTime.setToolTipText("<html>Travel in Time<br>Example: 19991212.235900");
        jTextFieldTime.setMinimumSize(new java.awt.Dimension(150, 20));
        jTextFieldTime.setName("jTextFieldTime"); // NOI18N
        jTextFieldTime.setPreferredSize(new java.awt.Dimension(150, 20));
        jTextFieldTime.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                jTextFieldTimeCaretUpdate(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
        jPanelMore.add(jTextFieldTime, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 5);
        jPanelExamples.add(jPanelMore, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 12);
        jPanelControls.add(jPanelExamples, gridBagConstraints);

        jPanelControlsAtRightSide.setName("jPanelControlsAtRightSide"); // NOI18N
        jPanelControlsAtRightSide.setLayout(new java.awt.GridBagLayout());

        jPanelSizeOnScreeFOV.setBorder(javax.swing.BorderFactory.createTitledBorder("Field of View"));
        jPanelSizeOnScreeFOV.setName("jPanelSizeOnScreeFOV"); // NOI18N
        jPanelSizeOnScreeFOV.setLayout(new java.awt.GridBagLayout());

        jPanelDistanceSizeFOV.setName("jPanelDistanceSizeFOV"); // NOI18N
        jPanelDistanceSizeFOV.setLayout(new java.awt.GridBagLayout());

        jLabelDistance.setText("<html>Celestial Body seen from a Distance of<br>\n[Radius of Body]"); // NOI18N
        jLabelDistance.setName("jLabelDistance"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 7);
        jPanelDistanceSizeFOV.add(jLabelDistance, gridBagConstraints);

        jSliderDistance.setMajorTickSpacing(1000);
        jSliderDistance.setMaximum(5000);
        jSliderDistance.setMinorTickSpacing(100);
        jSliderDistance.setPaintLabels(true);
        jSliderDistance.setPaintTicks(true);
        jSliderDistance.setSnapToTicks(true);
        jSliderDistance.setName("jSliderDistance"); // NOI18N
        jSliderDistance.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jSliderDistanceMouseReleased(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        jPanelDistanceSizeFOV.add(jSliderDistance, gridBagConstraints);

        jLabelSizeOnScreen.setText("<html>Size of Celestial Body on Screen<br>\n[in % of Screen Width]"); // NOI18N
        jLabelSizeOnScreen.setName("jLabelSizeOnScreen"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.insets = new java.awt.Insets(12, 7, 0, 7);
        jPanelDistanceSizeFOV.add(jLabelSizeOnScreen, gridBagConstraints);

        jSliderSizeOnScreen.setMajorTickSpacing(25);
        jSliderSizeOnScreen.setMaximum(200);
        jSliderSizeOnScreen.setMinorTickSpacing(5);
        jSliderSizeOnScreen.setPaintLabels(true);
        jSliderSizeOnScreen.setPaintTicks(true);
        jSliderSizeOnScreen.setSnapToTicks(true);
        jSliderSizeOnScreen.setName("jSliderSizeOnScreen"); // NOI18N
        jSliderSizeOnScreen.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jSliderSizeOnScreenMouseReleased(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
        jPanelDistanceSizeFOV.add(jSliderSizeOnScreen, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        jPanelSizeOnScreeFOV.add(jPanelDistanceSizeFOV, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(7, 0, 7, 0);
        jPanelControlsAtRightSide.add(jPanelSizeOnScreeFOV, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        jPanelControls.add(jPanelControlsAtRightSide, gridBagConstraints);

        jPanelButtons.setName("jPanelButtons"); // NOI18N
        jPanelButtons.setLayout(new java.awt.GridBagLayout());

        jPanel1.setMinimumSize(null);
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(null);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        gridBagConstraints.weighty = 1.0;
        jPanelButtons.add(jPanel1, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
        jPanelControls.add(jPanelButtons, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanelMain.add(jPanelControls, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 5, 12);
        add(jPanelMain, gridBagConstraints);
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBoxOriginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxOriginActionPerformed
        this.setToChangedConfig(this.jComboBoxOrigin);
        this.sendParameter(this.jComboBoxOrigin, "-origin", "(?i)(-origin\\s((-sun)|(-mercury)|(-venus)|(-earth)|(-moon)|(-mars)|(-phobos)|(-deimos)|(-jupiter)|(-io)|(-europa)|(-ganymede)|(-callisto)|(-saturn)|(-mimas)|(-enceladus)|(-tethys)|(-dione)|(-rhea)|(-titan)|(-hyperion)|(-iapetus)|(-phoebe)|(-uranus)|(-miranda)|(-ariel)|(-umbriel)|(-titania)|(-oberon)|(-neptune)|(-triton)|(-nereid)|(-pluto)|(-charon)|(-random)|(-major)))|(-origin\\b\\s*[^-]*)");
}//GEN-LAST:event_jComboBoxOriginActionPerformed

    private void jComboBoxTargetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTargetActionPerformed
        this.setToChangedConfig(this.jComboBoxTarget);
        this.sendParameter(this.jComboBoxTarget, "-body", "(?i)(-body\\b|-target\\b)(\\s*\\S*[^-]*)");
}//GEN-LAST:event_jComboBoxTargetActionPerformed

    private void jComboBoxVerbosityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxVerbosityActionPerformed
        this.setToChangedConfig(this.jComboBoxVerbosity);
        this.sendParameter(this.jComboBoxVerbosity, "-verbosity", "(?i)(-verbosity\\s(-\\d+))|(-verbosity\\b\\s*[^-]*)");
}//GEN-LAST:event_jComboBoxVerbosityActionPerformed

    private void jSliderLatitudeMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSliderLatitudeMouseReleased
        this.setToChangedConfig(this.jSliderLatitude);
        this.sendParameter(this.jSliderLatitude, "-latitude", "(?i)(-latitude\\b)(\\s*)((-$)|(-[^\\p{Alpha}])*)\\d*");
    }//GEN-LAST:event_jSliderLatitudeMouseReleased

    private void jSliderLongitudeMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSliderLongitudeMouseReleased
        this.setToChangedConfig(this.jSliderLongitude);
        this.sendParameter(this.jSliderLongitude, "-longitude", "(?i)(-longitude\\b)(\\s*)((-$)|(-[^\\p{Alpha}])*)\\d*");
    }//GEN-LAST:event_jSliderLongitudeMouseReleased

    private void jSliderMagnificationMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSliderMagnificationMouseReleased
        this.setToChangedConfig(this.jSliderMagnification);
        this.sendConfigParameter(this.jSliderMagnification, "magnify", "(?i)(magnify=)(\\S*)");
    }//GEN-LAST:event_jSliderMagnificationMouseReleased

    private void jSliderDistanceMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSliderDistanceMouseReleased
        this.setToChangedConfig(this.jSliderDistance);
        this.sendParameter(this.jSliderDistance, "-range", "(?i)(-range\\b)(\\s*)([^-]*)");
}//GEN-LAST:event_jSliderDistanceMouseReleased

    private void jSliderSizeOnScreenMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSliderSizeOnScreenMouseReleased
        this.setToChangedConfig(this.jSliderSizeOnScreen);
        this.sendParameter(this.jSliderSizeOnScreen, "-radius", "(?i)(-radius\\b)(\\s*)([^-]*)");
}//GEN-LAST:event_jSliderSizeOnScreenMouseReleased

    private void jCheckBoxLabelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxLabelActionPerformed
        this.setToChangedConfig(this.jCheckBoxLabel);
        this.sendParameter(this.jCheckBoxLabel, "-label", "(?i)(-label)(\\s*)([^-]*)");
    }//GEN-LAST:event_jCheckBoxLabelActionPerformed

    private void jTextFieldTimeCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_jTextFieldTimeCaretUpdate
        this.setToChangedConfig(this.jTextFieldTime);
        this.sendParameter(this.jTextFieldTime, "-date", "(?i)(-date)(\\s*)([^-]*)");
    }//GEN-LAST:event_jTextFieldTimeCaretUpdate

    private void jComboBoxSuggestionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxSuggestionsActionPerformed
        if (this.jComboBoxSuggestions.hasFocus()) {
            this.switchConfiguration();
        }
    }//GEN-LAST:event_jComboBoxSuggestionsActionPerformed

    private void jRadioButtonOtherBodyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonOtherBodyActionPerformed
        this.switchOrigin();
        this.setToChangedConfig(this.jRadioButtonOtherBody);
        // Remove latitude and longitude in command line parameters
        this.sendParameter("", "-latitude", "(?i)(-latitude\\b)(\\s*)((-$)|(-[^\\p{Alpha}])*)\\d*");
        this.sendParameter("", "-longitude", "(?i)(-longitude\\b)(\\s*)((-$)|(-[^\\p{Alpha}])*)\\d*");
    }//GEN-LAST:event_jRadioButtonOtherBodyActionPerformed

    private void jRadioButtonPositionOverBodyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonPositionOverBodyActionPerformed
        // This selects the emty list item in combobox origin
        this.switchOrigin();
        this.setToChangedConfig(this.jRadioButtonPositionOverBody);
        // Remove the -target / -body from command line parameters
        this.sendParameterIgnoreFocus(this.jComboBoxOrigin, "-origin", "(?i)(-origin\\s((-sun)|(-mercury)|(-venus)|(-earth)|(-moon)|(-mars)|(-phobos)|(-deimos)|(-jupiter)|(-io)|(-europa)|(-ganymede)|(-callisto)|(-saturn)|(-mimas)|(-enceladus)|(-tethys)|(-dione)|(-rhea)|(-titan)|(-hyperion)|(-iapetus)|(-phoebe)|(-uranus)|(-miranda)|(-ariel)|(-umbriel)|(-titania)|(-oberon)|(-neptune)|(-triton)|(-nereid)|(-pluto)|(-charon)|(-random)|(-major)))|(-origin\\b\\s*[^-]*)");
        // Set latitude and longitude in command line parameters
        this.sendParameterIgnoreFocus(this.jSliderLatitude, "-latitude", "(?i)(-latitude\\b)(\\s*)((-$)|(-[^\\p{Alpha}])*)\\d*");
        this.sendParameterIgnoreFocus(this.jSliderLongitude, "-longitude", "(?i)(-longitude\\b)(\\s*)((-$)|(-[^\\p{Alpha}])*)\\d*");
    }//GEN-LAST:event_jRadioButtonPositionOverBodyActionPerformed

    private void jCheckBoxShowStarsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxShowStarsActionPerformed
        this.setToChangedConfig(this.jCheckBoxShowStars);
        if (!this.jCheckBoxShowStars.hasFocus()) {
            return;
        }
        if (this.jCheckBoxShowStars.isSelected()) {
            // -log_magstep 1
            this.sendParameter("1", "-log_magstep", "(?i)(-log_magstep\\b)(\\s*)([^-]*)");
        } else {
            this.sendParameter("", "-log_magstep", "(?i)(-log_magstep\\b)(\\s*)([^-]*)");
        }
    }//GEN-LAST:event_jCheckBoxShowStarsActionPerformed

    private void jCheckBoxLabelStarsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxLabelStarsActionPerformed
        this.setToChangedConfig(this.jCheckBoxLabelStars);
        if (!this.jCheckBoxLabelStars.hasFocus()) {
            return;
        }
        if (this.jCheckBoxLabelStars.isSelected()) {
            // -marker_file brightStars
            this.sendParameter("brightStars", "-marker_file", "(?i)(-marker_file\\b)(\\s*)([^-]*)");
        } else {
            this.sendParameter("", "-marker_file", "(?i)(-marker_file\\b)(\\s*)([^-]*)");
        }
    }//GEN-LAST:event_jCheckBoxLabelStarsActionPerformed

    private void jCheckBoxArcsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxArcsActionPerformed
        this.setToChangedConfig(this.jCheckBoxArcs);
        if (!this.jCheckBoxArcs.hasFocus()) {
            return;
        }
        if (this.jCheckBoxArcs.isSelected()) {
            // -arc_file constellations
            this.sendParameter("constellations", "-arc_file", "(?i)(-arc_file\\b)(\\s*)([^-]*)");
        } else {
            this.sendParameter("", "-arc_file", "(?i)(-arc_file\\b)(\\s*)([^-]*)");
        }
    }//GEN-LAST:event_jCheckBoxArcsActionPerformed

    private void jCheckBoxCloudsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxCloudsActionPerformed
        this.setToChangedConfig(this.jCheckBoxClouds);
        // The config file is concerned (not a parameter of the command line)
        if (this.jCheckBoxClouds.isSelected()) {
            this.appendToDownloader("clouds\\.cloud\\..+", "clouds");
            String defaultValue = this.getFileNameFromDownloader("(clouds.cloud.url.selected=.*/)(\\S+)", 2);
            this.sendConfigParameter("earth", "cloud_map", defaultValue, "(?i)(cloud_map=)(\\S*)");
        } else {
            this.sendConfigParameter("earth", "cloud_map", "", "(?i)(cloud_map=)(\\S*)");
            this.removeLinesFromDownloader("clouds\\.cloud\\..+");
        }
    }//GEN-LAST:event_jCheckBoxCloudsActionPerformed

    private void jCheckBoxStormsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxStormsActionPerformed
        this.setToChangedConfig(this.jCheckBoxStorms);
        // The config file is concerned (not a parameter of the command line)
        this.appendToDownloader("markers\\.storms\\..+", "storms"); // The default value is read from the downloader config
        String defaultValue = this.getFileNameFromDownloader("(markers.storms.url.selected=.*/)(\\S+)", 2);
        if (this.jCheckBoxStorms.isSelected()) {
            this.insertConfigParameter("earth", "marker_file=" + defaultValue, "(?i).*marker_file=" + defaultValue + ".*");
        } else {
            this.removeConfigParameter("earth", "(?i).*marker_file=" + defaultValue + ".*");
            this.removeLinesFromDownloader("markers\\.storms\\..+");
        }
    }//GEN-LAST:event_jCheckBoxStormsActionPerformed

    private void jCheckBoxVolcanosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxVolcanosActionPerformed
        this.setToChangedConfig(this.jCheckBoxVolcanos);
        // The config file is concerned (not a parameter of the command line)
        this.appendToDownloader("markers\\.volcanos\\..+", "volcanos"); // The default value is read from the downloader config
        String defaultValue = this.getFileNameFromDownloader("(markers.volcanos.url.selected=.*/)(\\S+)", 2);
        if (this.jCheckBoxVolcanos.isSelected()) {
            this.insertConfigParameter("earth", "marker_file=" + defaultValue, "(?i).*marker_file=" + defaultValue + ".*");
        } else {
            this.removeConfigParameter("earth", "(?i).*marker_file=" + defaultValue + ".*");
            this.removeLinesFromDownloader("markers\\.volcanos\\..+");
        }
    }//GEN-LAST:event_jCheckBoxVolcanosActionPerformed

    private void jCheckBoxISSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxISSActionPerformed
        this.setToChangedConfig(this.jCheckBoxISS);
        // The config file is concerned (not a parameter of the command line)
        this.appendToDownloader("satellites\\..+", "iss"); // The default value is read from the downloader config
        String defaultValue = this.getFileNameFromDownloader("(satellites.iss.url.selected=.*/)(\\S+)", 2);
        if (this.jCheckBoxISS.isSelected()) {
            this.insertConfigParameter("earth", "satellite_file=" + defaultValue, "(?i).*satellite_file=" + defaultValue + ".*");
        } else {
            this.removeConfigParameter("earth", "(?i).*satellite_file=" + defaultValue + ".*");
            this.removeLinesFromDownloader("satellites\\..+");
        }
    }//GEN-LAST:event_jCheckBoxISSActionPerformed

    private void jCheckBoxEarthQuakesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxEarthQuakesActionPerformed
        this.setToChangedConfig(this.jCheckBoxEarthQuakes);
        // The config file is concerned (not a parameter of the command line)
        this.appendToDownloader("markers\\.quakes\\..+", "quakes"); // The default value is read from the downloader config
        String defaultValue = this.getFileNameFromDownloader("(markers.quakes.url.selected=.*/)(\\S+)", 2);
        if (this.jCheckBoxEarthQuakes.isSelected()) {
            this.insertConfigParameter("earth", "marker_file=" + defaultValue, "(?i).*marker_file=" + defaultValue + ".*");
        } else {
            this.removeConfigParameter("earth", "(?i).*marker_file=" + defaultValue + ".*");
            this.removeLinesFromDownloader("markers\\.quakes\\..+");
        }
    }//GEN-LAST:event_jCheckBoxEarthQuakesActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroupOrigin;
    private javax.swing.JCheckBox jCheckBoxArcs;
    private javax.swing.JCheckBox jCheckBoxClouds;
    private javax.swing.JCheckBox jCheckBoxEarthQuakes;
    private javax.swing.JCheckBox jCheckBoxISS;
    private javax.swing.JCheckBox jCheckBoxLabel;
    private javax.swing.JCheckBox jCheckBoxLabelStars;
    private javax.swing.JCheckBox jCheckBoxShowStars;
    private javax.swing.JCheckBox jCheckBoxStorms;
    private javax.swing.JCheckBox jCheckBoxVolcanos;
    private javax.swing.JComboBox jComboBoxOrigin;
    private javax.swing.JComboBox jComboBoxSuggestions;
    private javax.swing.JComboBox jComboBoxTarget;
    private javax.swing.JComboBox jComboBoxVerbosity;
    private javax.swing.JLabel jLabelBodyVerbosity;
    private javax.swing.JLabel jLabelDistance;
    private javax.swing.JLabel jLabelMagnify;
    private javax.swing.JLabel jLabelOriginDecision;
    private javax.swing.JLabel jLabelSizeOnScreen;
    private javax.swing.JLabel jLabelSuggestions;
    private javax.swing.JLabel jLabelTarget;
    private javax.swing.JLabel jLabelTime;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelButtons;
    private javax.swing.JPanel jPanelControls;
    private javax.swing.JPanel jPanelControlsAtRightSide;
    private javax.swing.JPanel jPanelDistanceSizeFOV;
    private javax.swing.JPanel jPanelEarth;
    private javax.swing.JPanel jPanelExamples;
    private javax.swing.JPanel jPanelFromAt;
    private javax.swing.JPanel jPanelMagniificaton;
    private javax.swing.JPanel jPanelMain;
    private javax.swing.JPanel jPanelMore;
    private javax.swing.JPanel jPanelOrigin;
    private javax.swing.JPanel jPanelOriginDecision;
    private javax.swing.JPanel jPanelSizeOnScreeFOV;
    private javax.swing.JPanel jPanelStars;
    private javax.swing.JPanel jPanelTarget;
    private javax.swing.JPanel jPanelWhatElseToShow;
    private javax.swing.JRadioButton jRadioButtonOtherBody;
    private javax.swing.JRadioButton jRadioButtonPositionOverBody;
    private javax.swing.JSlider jSliderDistance;
    private javax.swing.JSlider jSliderLatitude;
    private javax.swing.JSlider jSliderLongitude;
    private javax.swing.JSlider jSliderMagnification;
    private javax.swing.JSlider jSliderSizeOnScreen;
    private javax.swing.JTextField jTextFieldTime;
    // End of variables declaration//GEN-END:variables

    @Override
    boolean receiveCommandLineParameters(String parameters) throws XPlanetException {
        // Do nothing
        return true;
    }

    public String getText() {
        // nothing to seach
        return "";
    }

    public JTextComponent getTextComponent() {
        // nothing to seach
        return null;
    }

    private void fillComponents() {
        // List origin
        this.originNames = new ArrayList();
        this.originNames.add("");
        this.originNames.add("sun");
        this.originNames.add("mercury");
        this.originNames.add("venus");
        this.originNames.add("earth");
        this.originNames.add("moon");
        this.originNames.add("mars");
        this.originNames.add("phobos");
        this.originNames.add("deimos");
        this.originNames.add("jupiter");
        this.originNames.add("io");
        this.originNames.add("europa");
        this.originNames.add("ganymede");
        this.originNames.add("callisto");
        this.originNames.add("saturn");
        this.originNames.add("mimas");
        this.originNames.add("enceladus");
        this.originNames.add("tethys");
        this.originNames.add("dione");
        this.originNames.add("rhea");
        this.originNames.add("titan");
        this.originNames.add("hyperion");
        this.originNames.add("iapetus");
        this.originNames.add("phoebe");
        this.originNames.add("uranus");
        this.originNames.add("miranda");
        this.originNames.add("ariel");
        this.originNames.add("umbriel");
        this.originNames.add("titania");
        this.originNames.add("oberon");
        this.originNames.add("neptune");
        this.originNames.add("triton");
        this.originNames.add("nereid");
        this.originNames.add("pluto");
        this.originNames.add("charon");
        this.originNames.add("random");
        this.originNames.add("major");

        Iterator it = this.originNames.iterator();
        while (it.hasNext()) {
            String name = (String) it.next();
            this.jComboBoxOrigin.addItem(name);
        }

        // List target

        this.targetNames = new ArrayList();
        this.targetNames.add("");
        this.targetNames.add("sun");
        this.targetNames.add("mercury");
        this.targetNames.add("venus");
        this.targetNames.add("earth");
        this.targetNames.add("moon");
        this.targetNames.add("mars");
        this.targetNames.add("phobos");
        this.targetNames.add("deimos");
        this.targetNames.add("jupiter");
        this.targetNames.add("io");
        this.targetNames.add("europa");
        this.targetNames.add("ganymede");
        this.targetNames.add("callisto");
        this.targetNames.add("saturn");
        this.targetNames.add("mimas");
        this.targetNames.add("enceladus");
        this.targetNames.add("tethys");
        this.targetNames.add("dione");
        this.targetNames.add("rhea");
        this.targetNames.add("titan");
        this.targetNames.add("hyperion");
        this.targetNames.add("iapetus");
        this.targetNames.add("phoebe");
        this.targetNames.add("uranus");
        this.targetNames.add("miranda");
        this.targetNames.add("ariel");
        this.targetNames.add("umbriel");
        this.targetNames.add("titania");
        this.targetNames.add("oberon");
        this.targetNames.add("neptune");
        this.targetNames.add("triton");
        this.targetNames.add("nereid");
        this.targetNames.add("pluto");
        this.targetNames.add("charon");
        this.targetNames.add("random");
        this.targetNames.add("major");

        it = this.targetNames.iterator();
        while (it.hasNext()) {
            String name = (String) it.next();
            this.jComboBoxTarget.addItem(name);
        }

        // verbosity of XPlanet
        List verbosityLevels = new ArrayList();
        verbosityLevels.add("");
        verbosityLevels.add("-1");
        verbosityLevels.add("0");
        verbosityLevels.add("1");
        verbosityLevels.add("2");
        verbosityLevels.add("3");
        verbosityLevels.add("4");

        it = verbosityLevels.iterator();
        while (it.hasNext()) {
            String name = (String) it.next();
            this.jComboBoxVerbosity.addItem(name);
        }

        // verbosity of XPlanet
        this.exampleConfigurations = new ArrayList();
        exampleConfigurations.add("Default");
        exampleConfigurations.add("Earth_Big_Moon");
        exampleConfigurations.add("Earth_Clouds_Big_Moon");
        exampleConfigurations.add("Earth_Big_Moon_Satellites");
        exampleConfigurations.add("Over_Europe_Clouds_Satellites_Big_Moon");
        exampleConfigurations.add("Europe_Magnified");
        exampleConfigurations.add("Saturn");

        it = exampleConfigurations.iterator();
        while (it.hasNext()) {
            String name = (String) it.next();
            this.jComboBoxSuggestions.addItem(name);
        }
    }

    private void writeExampleConfigurationFromJarToFileSystem(String exampleName) {
        FileUtil util = new FileUtil();
        String dirInClasspath = "/xplanetconfigurator/gui/resources/examples/";
        String fileInClasspath = dirInClasspath + exampleName;
        XPlanetRessourceFinder f = new XPlanetRessourceFinder();
        String dirOnDisc = f.getRessourceDirectory("config");
        String fileOnDisc = dirOnDisc + File.separator + exampleName;
        String msg = "Copy example config file from classpath to file system... '" + fileInClasspath + "' > '" + fileOnDisc + "'";
        this.logger.finer(msg);
        try {
            util.copyRessourceFileToFileSystem(fileInClasspath, fileOnDisc);
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, "Faile to do: " + msg, ex);
            msg = "Failed to copy example config file from classpath to file system...\n'" + fileInClasspath + "'\nto\n'" + fileOnDisc + "'";
            this.popError(msg);
        }
    }

    @Override
    void receiveCommandLineParameters() {
        //----------------------------------------------------------------------
        //-- The command line parameters ---------------------------------------
        // Controls set by parameters of the command line-----------------------
        // They are read from the text area of that shows the parameters of the
        // command line. Befor the where read from a comment line of the
        // config file (that was 'misused' to store the commandline parameter
        // along with the config file.)
        String cmdLineParams = this.getMainFrame().getParameters();

        // Set the combo box with examples
        String regExpr = "(?i)(-config\\b)(\\s*)([^-]*)";
        // If the -config is not in the list of examples than 'Default' will
        // automatically set
        // Add 'Changed' to the list if its not contained in the list
        if (!this.exampleConfigurations.contains(this.NAME_CHANGED)) {
            this.exampleConfigurations.add(this.NAME_CHANGED);
        }
        this.receiveParameter(this.jComboBoxSuggestions, this.exampleConfigurations, cmdLineParams, regExpr, 3);

        // Examples from the JAR allways overwrite the changed from the expert GUI
        // Check what was found in the parameters
        String selectedItem = (String) this.jComboBoxSuggestions.getSelectedItem();
        int count = this.jComboBoxSuggestions.getItemCount();
        for (int i = 0; i < count; i++) {
            String exampleName = (String) this.jComboBoxSuggestions.getItemAt(i);
            if (selectedItem.equals(this.NAME_CHANGED)) {
                // Do nothing because the user deliberatly changed someting
            } else if (exampleName.equals(selectedItem)) {
                // This changes the configuration. The config is loaded from jar file
                // and overwrites allway configurations made by the user (on file system)
                // What is overwritten by on of the examples from the jar file?
                // - command line
                // - config file
                // - config of downloader
                this.loadConfig(exampleName);
                // Read the chaned command line parameters (from the text area)
                cmdLineParams = this.getMainFrame().getParameters();
                break;
            }
        }

        // Get the origin: body or fixed position over body
        regExpr = "(?i)(-origin\\b)(\\s*)(-\\w+)|(-origin\\b)(\\s*)([^-]*)";
        String found = this.receiveParameter(this.jComboBoxOrigin, cmdLineParams, regExpr, 3, 6);
        if (found == null) {
            this.jRadioButtonPositionOverBody.setSelected(true);
            // latitude
            regExpr = "(?i)(-latitude\\b\\s*)(((-$)|(-[^\\p{Alpha}])*)\\d*)";
            this.receiveParameter(cmdLineParams, regExpr, 2, this.jSliderLatitude);
            // longitude
            regExpr = "(?i)(-longitude\\b\\s*)(((-$)|(-[^\\p{Alpha}])*)\\d*)";
            this.receiveParameter(cmdLineParams, regExpr, 2, this.jSliderLongitude);
        } else {
            this.jRadioButtonOtherBody.setSelected(true);
        }
        this.switchOrigin();

        regExpr = "(?i)(-body\\b)(\\s*)([^-]*)|(-target\\b)(\\s*)([^-]*)";
        this.receiveParameter(this.jComboBoxTarget, cmdLineParams, regExpr, 3, 6);

        // Size on screen and FOV (field of view)
        regExpr = "(?i)(-range\\b)(\\s*)([^-]*)";
        this.receiveParameter(cmdLineParams, regExpr, 3, this.jSliderDistance);
        regExpr = "(?i)(-radius\\b)(\\s*)([^-]*)";
        this.receiveParameter(cmdLineParams, regExpr, 3, this.jSliderSizeOnScreen);

        // What else to show
        regExpr = "(?i)(-label\\b)";
        this.receiveParameter(cmdLineParams, regExpr, this.jCheckBoxLabel);
        // ...concerning stars
        regExpr = "(?i)(-log_magstep\\b)(\\s*)([^-]*)";
        this.receiveParameter(cmdLineParams, regExpr, this.jCheckBoxShowStars);
        regExpr = "(?i)(-marker_file\\b)(\\s*)([^-]*)";
        this.receiveParameter(cmdLineParams, regExpr, this.jCheckBoxLabelStars);
        regExpr = "(?i)(-arc_file\\b)(\\s*)([^-]*)";
        this.receiveParameter(cmdLineParams, regExpr, this.jCheckBoxArcs);

        // More
        regExpr = "(?i)(-verbosity\\b)(\\s*)(-\\d+)|(-verbosity\\b)(\\s*)([^-]*)";
        this.receiveParameter(this.jComboBoxVerbosity, cmdLineParams, regExpr, 3, 6);
        regExpr = "(?i)(-date\\b)(\\s*)([^-]*)";
        this.receiveParameter(cmdLineParams, regExpr, this.jTextFieldTime);

        //----------------------------------------------------------------------
        //-- The configuration parameters --------------------------------------
        // They are read from the text area of that shows the content of the
        // config file
        // The content of the whole text field could be used as well but the
        // section text for 'default' and 'earth' is more precise (just to
        // be sure.)
        // String params = this.getMainFrame().getConfigParameters();

        //-- parameters from section 'default' ---------------------------------
        String sectionText = this.getWholeSectionFor("default");
        regExpr = "(?i)(magnify=)(\\S+)";
        this.receiveParameter(sectionText, regExpr, 2, this.jSliderMagnification);

        // -- parameters from section 'earth' ----------------------------------
        sectionText = this.getWholeSectionFor("earth");

        // clouds
        String defaultValue = this.getFileNameFromDownloader("(clouds.cloud.url.selected=.*/)(\\S+)", 2);
        regExpr = "(?i).*cloud_map=" + defaultValue + ".*";
        this.receiveParameter(sectionText, regExpr, this.jCheckBoxClouds);

        // volcano
        defaultValue = this.getFileNameFromDownloader("(markers.volcanos.url.selected=.*/)(\\S+)", 2);
        if ("".equals(defaultValue)) {
            // This should only be the case if the user modified the markers
            // by using expert mode. Unpossible but not impossible.
            defaultValue = "volcano";
        }
        regExpr = "(?i).*marker_file=" + defaultValue + ".*";
        this.receiveParameter(sectionText, regExpr, this.jCheckBoxVolcanos);

        // earth quakes
        defaultValue = this.getFileNameFromDownloader("(markers.quakes.url.selected=.*/)(\\S+)", 2);
        if ("".equals(defaultValue)) {
            // This should only be the case if the user modified the markers
            // by using expert mode. Unpossible but not impossible.
            defaultValue = "quake";
        }
        regExpr = "(?i).*marker_file=" + defaultValue + ".*";
        this.receiveParameter(sectionText, regExpr, this.jCheckBoxEarthQuakes);

        // storms
        defaultValue = this.getFileNameFromDownloader("(markers.storms.url.selected=.*/)(\\S+)", 2);
        if ("".equals(defaultValue)) {
            // This should only be the case if the user modified the markers
            // by using expert mode. Unpossible but not impossible.
            defaultValue = "storm";
        }
        regExpr = "(?i).*marker_file=" + defaultValue + ".*";
        this.receiveParameter(sectionText, regExpr, this.jCheckBoxStorms);

        // iss, satellite_file=iss
        defaultValue = this.getFileNameFromDownloader("(satellites.iss.url.selected=.*/)(\\S+)", 2);
        if ("".equals(defaultValue)) {
            // This should only be the case if the user modified the markers
            // by using expert mode. Unpossible but not impossible.
            defaultValue = "iss";
        }
        regExpr = "(?i).*satellite_file=" + defaultValue + ".*";
        this.receiveParameter(sectionText, regExpr, this.jCheckBoxISS);
    }

    /**
     * The user did choose another example configuration from the list
     * The example configurations are allways loaded from JAR via copy to
     * file system and loaded there from.
     */
    private void switchConfiguration() {
        String exampleConfigName = (String) this.jComboBoxSuggestions.getSelectedItem();
        this.loadConfig(exampleConfigName);
        // Set the controls
        this.receiveCommandLineParameters();
    }

    /**
     * Load the configuration including command line parameters from JAR files.
     * Load the downloader config from JAR files.
     * Fill their text areas. The text areas are the place where the controls
     * read their values from.
     * This sets the image=xy.jpg for every section if the file name of the
     * downloaded URL does not correspond to the name of the target, i.e.
     * if the downloader downloads 'earth.jpg' for 'earth' nothing is touched, but
     * if the downloader downloades 'pathfinder.jpg for 'earth' the config is
     * changed. The section [earth] will get a line 'image=pathfinder.jpg'.
     * @param configName one of the example configuration
     */
    private void loadConfig(String configName) {
        // Config name is used by this application to (not only by xplanet).
        // Thats why it is set here at this place.
        MainFrame.setCONFIG_NAME(configName);
        if (!configName.equalsIgnoreCase(this.NAME_CHANGED)) {
            // Allways overwrite files that do exist in file system
            // this.getMainFrame().readExampleConfigFile(exampleConfigName);
            this.writeExampleConfigurationFromJarToFileSystem(configName);
        }
        // Set the -config parameter in the text area
        this.sendParameter(this.jComboBoxSuggestions, "-config", "(?i)(-config\\b)(\\s*\\S*[^-]*)");
        // Read in the config file.
        this.getMainFrame().loadConfigurationFromFiles();
        // Read the downloader configuration
        String filename = configName + "_downloader";
        String dirInClasspath = "/xplanetconfigurator/gui/resources/examples/";
        String fileInClasspath = dirInClasspath + filename;
        String msg = "Reading downloader config file from classpath (jar):\n" + fileInClasspath + "'";
        this.logger.finer(msg);
        String fileContent = null;
        FileUtil util = new FileUtil();
        try {
            fileContent = util.getRessourceAsString(fileInClasspath);
        } catch (Exception ex) {
            msg = ex + "\nFailed to: " + msg;
            this.logger.log(Level.SEVERE, "Failed to do: " + msg, ex);
            this.popError(msg);
        }
        // This includes saving the downloader configuration to file
        this.getMainFrame().setDownloaderConfiguration(fileContent);
        // Insert the proxy configuration
        this.getMainFrame().insertProxyConfigurationFromFile();

        // Check if the file names of the downloaded maps are equal to the section / target name
        this.checkAllMapsInConfig(fileContent);
    }

    private void switchOrigin() {
        this.jSliderLongitude.setEnabled(this.jRadioButtonPositionOverBody.isSelected());
        this.jSliderLatitude.setEnabled(this.jRadioButtonPositionOverBody.isSelected());
        if (this.jRadioButtonPositionOverBody.isSelected()) {
            this.jComboBoxOrigin.setSelectedItem("");
        }
        this.jComboBoxOrigin.setEnabled(this.jRadioButtonOtherBody.isSelected());
    }

    /**
     * Used if if the user changes a pre defined configuration. The list element
     * 'Changed' will be selected in the combo box.
     */
    private void setToChangedConfig(java.awt.Component component) {
        if (!component.hasFocus()) {
            return;
        }
        MainFrame.setCONFIG_NAME(this.NAME_CHANGED);
        String item = (String) this.jComboBoxSuggestions.getSelectedItem();
        if (!item.equals(this.NAME_CHANGED)) {
            // Select in list
            int count = this.jComboBoxSuggestions.getItemCount();
            for (int i = 0; i < count; i++) {
                item = (String) this.jComboBoxSuggestions.getItemAt(i);
                if (item.equals(this.NAME_CHANGED)) {
                    // yes, it does exits > select
                    this.jComboBoxSuggestions.setSelectedItem(this.NAME_CHANGED);
                    // Tell the text area showing the command line
                    this.sendParameterIgnoreFocus(this.jComboBoxSuggestions, "-config", "(?i)(-config\\b)(\\s*\\S*[^-]*)");
                    return;
                }
            }
            // The item 'changed' does not exist. Create one.
            this.jComboBoxSuggestions.addItem(this.NAME_CHANGED);
            this.jComboBoxSuggestions.setSelectedItem(this.NAME_CHANGED);
            // Tell the text area showing the command line
            this.sendParameterIgnoreFocus(this.jComboBoxSuggestions, "-config", "(?i)(-config\\b)(\\s*\\S*[^-]*)");
        }
    }

    /**
     * Get the used marker name from the selected URL in downloader.
     * Example: What marker for storms is currently downloaded? This is the
     * value 'storm' in the configuration 'maker_file=storm'. How to be sure it
     * ist used (downloaded) currently by the downloader. So ask the downloader.
     * In this example it has something like:
     * 'markers.storms.url.selected=http://www.wizabit.eclipse.co.uk/xplanet/files/local/arcs/storm'
     * For this example the file name 'storm' (afte last slash in URL) is downloaded
     * and stored locally. The same file name must appear in the config
     * (as in text area / file)
     * @param regExpression for example '(markers.storms.url.selected=.+/)(storm)'
     * for 'markers.storms.url.selected=http://www.wizabit.eclipse.co.uk/xplanet/files/local/arcs/storm'
     * @param group '2' for '(markers.storms.url.selected=.+/)(storm)'
     * @return the marker name (file name) in the config. 'storm' in the example.
     */
    private String getFileNameFromDownloader(String regExpression, int group) {
        String fileName = this.getValueFromDownloaderConfig(regExpression, group);
        return fileName;
    }

    /**
     * Remove all lines containing a regular expression from the downloader
     * config. Then insert the content of a file to the downloader config.
     * The file is written from the jar file.
     * @param regExpressionToRemove for example 'clouds\\.cloud'
     * @param fileToInsert for example 'clouds'
     */
    private void appendToDownloader(String regExpressionToRemove, String fileToInsert) {
        // Remove all lines from downloader
        this.removeLinesFromDownloader(regExpressionToRemove);

        // Insert the file content into the downloader
        // First get the file content from the file in the jar
        FileUtil util = new FileUtil();
        String fileInClasspath = "/xplanetconfigurator/gui/resources/examples/" + fileToInsert;
        String msg = "Reading file content from jar file.\nFile is:\n" + fileInClasspath;
        String fileContent = "";
        try {
            fileContent = util.getRessourceAsString(fileInClasspath);
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, "Failed to do: " + msg, ex);
            this.popError(msg);
            return;
        }
        // Second insert the file content into the downloader
        this.insertIntoDownloader(fileContent);
    }

    /**
     * Check wehter the name of the selected download file name for a map
     * is the same as the target name. If not set the file name of the
     * selected URL and add to the corresponding section in the config.
     * Example: target=sun, download URL has name with http://xy./../sunmap.jpg
     */
    private void checkAllMapsInConfig(String downloaderFileContent) {
        // Example line
        // maps.mars.url.selected=http://flatplanet.sourceforge.net/maps/images/mars.jpg
        String regExpr = "(maps\\.)(\\p{Alpha}+)(\\.url\\.selected=.+/)([^\\.]+)(\\.\\S+)";
        Pattern p = Pattern.compile(regExpr);
        Matcher matcher = p.matcher(downloaderFileContent);
        while (matcher.find()) {
            String found = matcher.group();
            this.logger.finest("Found selected URL for a map in the downloader config: " + found);
            // Find the target, e.g. sun, moon,...
            String target = matcher.group(2);
            if (target != null) {
                this.logger.finest("Found target / section '" + target + "'.");
                // Exclude satellite images
                if (target.startsWith("satimage")) {
                    this.logger.finest("Excluding images from satellites '" + target + "'.");
                    continue;
                }
            } else {
                this.logger.warning("Something wrong with a selelcted download URL in the downloader config. Missing file name suffix in '" + found + "'");
                return;
            }
            // Find the file name without the file name suffix, e.g. sun, sunmap, moon, iapetus_rgb_cyl_www,...
            String filenameWithoutSuffix = matcher.group(4);
            if (filenameWithoutSuffix != null) {
                this.logger.finest("Found file name without the file name suffix '" + filenameWithoutSuffix + "'.");
            } else {
                this.logger.warning("Something wrong with a selelcted download URL in the downloader config. Missing file name suffix in '" + found + "'");
                return;
            }
            // Find the file name suffix, e.g. '.jpg'
            String filenameSuffix = matcher.group(5);
            if (filenameSuffix != null) {
                this.logger.finest("Found file name suffix '" + filenameSuffix + "'.");
            } else {
                this.logger.warning("Something wrong with a selelcted download URL in the downloader config. Missing file name suffix in '" + found + "'");
                return;
            }
            // Check wether target name and filen name (without) suffix are the same
            if (target.equals(filenameWithoutSuffix)) {
                this.logger.finest("Nothing to do. The filename equals the target / section");
            } else {
                this.logger.finer("target / section '" + target + "' does not equal to the file name (without suffix) '" + filenameWithoutSuffix + "' in selected URL of downloader. Setting the map in the section.");
                // Insert something like 'image=venus_shaded.jpg' into the section
                String image = filenameWithoutSuffix + filenameSuffix;
                this.sendConfigParameter(target, "image", image, "(?i)(image=)(\\S*)");
            }

        }
    }
}
TOP

Related Classes of xplanetconfigurator.gui.JPanelControlParametersSimpleConfiguration

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.