Example usage for javax.swing DefaultComboBoxModel DefaultComboBoxModel

List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel

Introduction

In this page you can find the example usage for javax.swing DefaultComboBoxModel DefaultComboBoxModel.

Prototype

public DefaultComboBoxModel(Vector<E> v) 

Source Link

Document

Constructs a DefaultComboBoxModel object initialized with a vector.

Usage

From source file:jeplus.gui.JPanel_EPlusProjectFiles.java

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

    // Test if the template file is present
    String fn = (String) cboRviFile.getSelectedItem();
    if (fn.startsWith("Select ")) {
        fn = "my.rvx";
    }/* w w w  .j a  va 2s  . c  o  m*/
    String templfn = RelativeDirUtil.checkAbsolutePath(txtRviDir.getText() + fn, Project.getBaseDir());
    File ftmpl = new File(templfn);
    if (!ftmpl.exists()) {
        int n = JOptionPane.showConfirmDialog(this,
                "<html><p><center>" + templfn + " does not exist."
                        + "Do you want to copy one from an existing file?</center></p>"
                        + "<p> Alternatively, select 'NO' to create this file. </p>",
                "RVI file not available", JOptionPane.YES_NO_OPTION);
        if (n == JOptionPane.YES_OPTION) {
            // Select a file to open
            if (this.chkReadVar.isSelected()) {
                MainGUI.getFileChooser().setFileFilter(EPlusConfig.getFileFilter(EPlusConfig.RVX));
            } else {
                MainGUI.getFileChooser().setFileFilter(EPlusConfig.getFileFilter(EPlusConfig.RVI));
            }
            MainGUI.getFileChooser().setMultiSelectionEnabled(false);
            MainGUI.getFileChooser().setSelectedFile(new File(""));
            String rvidir = RelativeDirUtil.checkAbsolutePath(txtRviDir.getText(), Project.getBaseDir());
            MainGUI.getFileChooser().setCurrentDirectory(new File(rvidir));
            if (MainGUI.getFileChooser().showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
                File file = MainGUI.getFileChooser().getSelectedFile();
                try {
                    FileUtils.copyFile(file, new File(templfn));
                    cboRviFile.setModel(new DefaultComboBoxModel(new String[] { fn }));
                    Project.setRVIDir(txtRviDir.getText());
                    Project.setRVIFile(fn);
                } catch (IOException ex) {
                    logger.error("Error copying RVX from source.", ex);
                }
            }
            MainGUI.getFileChooser().resetChoosableFileFilters();
            MainGUI.getFileChooser().setSelectedFile(new File(""));
        } else if (n == JOptionPane.NO_OPTION) {

        } else {
            return;
        }
    }
    int idx = MainGUI.getTpnEditors().indexOfTab(fn);
    if (idx >= 0) {
        MainGUI.getTpnEditors().setSelectedIndex(idx);
    } else {
        EPlusEditorPanel RviFilePanel;
        if (FilenameUtils.getExtension(fn).equals("rvx")) {
            RviFilePanel = new EPlusEditorPanel(MainGUI.getTpnEditors(), fn, templfn,
                    EPlusEditorPanel.FileType.RVX, null);
        } else {
            RviFilePanel = new EPlusEditorPanel(MainGUI.getTpnEditors(), fn, templfn,
                    EPlusEditorPanel.FileType.RVI, null);
        }
        int ti = MainGUI.getTpnEditors().getTabCount();
        MainGUI.getTpnEditors().addTab(fn, RviFilePanel);
        RviFilePanel.setTabId(ti);
        MainGUI.getTpnEditors().setSelectedIndex(ti);
        MainGUI.getTpnEditors().setTabComponentAt(ti,
                new ButtonTabComponent(MainGUI.getTpnEditors(), RviFilePanel));
        MainGUI.getTpnEditors().setToolTipTextAt(ti, templfn);
    }
}

From source file:com.alvermont.terraj.fracplanet.ui.ControlsDialog.java

/** This method is called from within the constructor to
 * initialize the form.//from  w ww .  j  a  v  a2 s  . com
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */

// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    terrainButtonGroup = new javax.swing.ButtonGroup();
    regenTerrainButton = new javax.swing.JButton();
    regenRiverButton = new javax.swing.JButton();
    regenButton = new javax.swing.JButton();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jTabbedPane2 = new javax.swing.JTabbedPane();
    basicPanel = new javax.swing.JPanel();
    terrainTypeCombo = new javax.swing.JComboBox<String>();
    jLabel1 = new javax.swing.JLabel();
    baseHeightSpinner = new javax.swing.JSpinner();
    terrainSeedSpinner = new javax.swing.JSpinner();
    powerLawSpinner = new javax.swing.JSpinner();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jButton1 = new javax.swing.JButton();
    subdivPanel = new javax.swing.JPanel();
    subdivisionSpinner = new javax.swing.JSpinner();
    unperturbedSpinner = new javax.swing.JSpinner();
    vertPeturbSpinner = new javax.swing.JSpinner();
    horizPeturbSpinner = new javax.swing.JSpinner();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    jButton2 = new javax.swing.JButton();
    noisePanel = new javax.swing.JPanel();
    noiseTermSpinner = new javax.swing.JSpinner();
    noiseFrequencySpinner = new javax.swing.JSpinner();
    noiseAmplitudeSpinner = new javax.swing.JSpinner();
    noiseAmplitudeDecaySpinner = new javax.swing.JSpinner();
    jLabel9 = new javax.swing.JLabel();
    jLabel10 = new javax.swing.JLabel();
    jLabel11 = new javax.swing.JLabel();
    jLabel12 = new javax.swing.JLabel();
    jButton3 = new javax.swing.JButton();
    snowPanel = new javax.swing.JPanel();
    snowEquatorSpinner = new javax.swing.JSpinner();
    snowPoleSpinner = new javax.swing.JSpinner();
    snowPowerLawSpinner = new javax.swing.JSpinner();
    snowSlopeSpinner = new javax.swing.JSpinner();
    snowGlacierSpinner = new javax.swing.JSpinner();
    jLabel13 = new javax.swing.JLabel();
    jLabel14 = new javax.swing.JLabel();
    jLabel15 = new javax.swing.JLabel();
    jLabel16 = new javax.swing.JLabel();
    jLabel17 = new javax.swing.JLabel();
    jButton4 = new javax.swing.JButton();
    riverPanel = new javax.swing.JPanel();
    riverSpinner = new javax.swing.JSpinner();
    riverSeedSpinner = new javax.swing.JSpinner();
    riverLakeSeaSpinner = new javax.swing.JSpinner();
    jLabel18 = new javax.swing.JLabel();
    jLabel19 = new javax.swing.JLabel();
    jLabel20 = new javax.swing.JLabel();
    jButton5 = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    colourResetButton = new javax.swing.JButton();
    jLabel21 = new javax.swing.JLabel();
    jLabel22 = new javax.swing.JLabel();
    jLabel23 = new javax.swing.JLabel();
    jLabel24 = new javax.swing.JLabel();
    jLabel25 = new javax.swing.JLabel();
    jLabel26 = new javax.swing.JLabel();
    lowTerrainButton = new javax.swing.JButton();
    highTerrainButton = new javax.swing.JButton();
    oceanButton = new javax.swing.JButton();
    riverButton = new javax.swing.JButton();
    shorelineButton = new javax.swing.JButton();
    snowButton = new javax.swing.JButton();
    saveColoursButton = new javax.swing.JButton();
    loadColoursButton = new javax.swing.JButton();
    jLabel27 = new javax.swing.JLabel();
    oceansEmissiveSpinner = new javax.swing.JSpinner();
    jPanel8 = new javax.swing.JPanel();
    enableCloudsCheckbox = new javax.swing.JCheckBox();
    cloudsSubdivisionsCheckbox = new javax.swing.JCheckBox();
    cloudsSubdivisionSpinner = new javax.swing.JSpinner();
    jLabel35 = new javax.swing.JLabel();
    cloudsSeedSpinner = new javax.swing.JSpinner();
    jLabel36 = new javax.swing.JLabel();
    cloudButton = new javax.swing.JButton();
    resetCloudsButton = new javax.swing.JButton();
    jLabel37 = new javax.swing.JLabel();
    cloudsHeightSpinner = new javax.swing.JSpinner();
    renderPanel = new javax.swing.JPanel();
    jTabbedPane3 = new javax.swing.JTabbedPane();
    jPanel6 = new javax.swing.JPanel();
    jLabel30 = new javax.swing.JLabel();
    sunlightButton = new javax.swing.JButton();
    sunXSlider = new javax.swing.JSlider();
    sunYSlider = new javax.swing.JSlider();
    sunZSlider = new javax.swing.JSlider();
    jLabel31 = new javax.swing.JLabel();
    jLabel32 = new javax.swing.JLabel();
    jLabel33 = new javax.swing.JLabel();
    resetSunlightButton = new javax.swing.JButton();
    jPanel7 = new javax.swing.JPanel();
    fogButton = new javax.swing.JButton();
    jLabel34 = new javax.swing.JLabel();
    ambientSpinner = new javax.swing.JSpinner();
    resetAmbientButton = new javax.swing.JButton();
    enableFogCheckbox = new javax.swing.JCheckBox();
    jLabel29 = new javax.swing.JLabel();
    fogDistanceSpinner = new javax.swing.JSpinner();
    jPanel4 = new javax.swing.JPanel();
    resetRenderButton = new javax.swing.JButton();
    wireframeCheckbox = new javax.swing.JCheckBox();
    displayListCheckbox = new javax.swing.JCheckBox();
    nvidiaHackCheckbox = new javax.swing.JCheckBox();
    framesPerSecondSpinner = new javax.swing.JSpinner();
    jLabel28 = new javax.swing.JLabel();
    jPanel3 = new javax.swing.JPanel();
    exportSeaCheckbox = new javax.swing.JCheckBox();
    exportAtmosphereCheckbox = new javax.swing.JCheckBox();
    excludeAlternateCheckbox = new javax.swing.JCheckBox();
    resetExportButton = new javax.swing.JButton();
    jPanel5 = new javax.swing.JPanel();
    verticesLabel = new javax.swing.JLabel();
    trianglesLabel = new javax.swing.JLabel();
    landTriangleLabel = new javax.swing.JLabel();
    seaTriangleLabel = new javax.swing.JLabel();
    regenCloudsButton = new javax.swing.JButton();

    setTitle("Controls");
    regenTerrainButton.setAction(new RegenTerrainAction("RegenTerrain"));
    regenTerrainButton.setText("... with new terrain seed");

    regenRiverButton.setAction(new RegenRiversAction("RegenRivers"));
    regenRiverButton.setText("... with new rivers seed");

    regenButton.setAction(new RegenAction("Regenerate"));
    regenButton.setText("Regenerate");

    jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
    jTabbedPane2.addChangeListener(new javax.swing.event.ChangeListener() {
        @Override
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jTabbedPane2StateChanged(evt);
        }
    });

    terrainTypeCombo.setModel(new DefaultComboBoxModel<>(
            new String[] { "Planet", "Hexagonal Terrain", "Square Terrain", "Triangular Terrain" }));
    terrainTypeCombo.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            terrainTypeComboActionPerformed(evt);
        }
    });

    jLabel1.setText("Terrain type");

    baseHeightSpinner.setModel(new SpinnerNumberModel(0, -100, 100, 10));
    baseHeightSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            baseHeightSpinnerStateChanged(evt);
        }
    });

    terrainSeedSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            terrainSeedSpinnerStateChanged(evt);
        }
    });

    powerLawSpinner.setModel(new SpinnerNumberModel(1, 1, 10000, 10));
    powerLawSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            powerLawSpinnerStateChanged(evt);
        }
    });

    jLabel2.setText("Base land height (%)");

    jLabel3.setText("Terrain random seed");

    jLabel4.setText("Power law");

    jButton1.setText("Reset");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout basicPanelLayout = new org.jdesktop.layout.GroupLayout(basicPanel);
    basicPanel.setLayout(basicPanelLayout);
    basicPanelLayout.setHorizontalGroup(basicPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(basicPanelLayout.createSequentialGroup().addContainerGap().add(basicPanelLayout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(basicPanelLayout.createSequentialGroup()
                            .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel1).add(jLabel2).add(jLabel3).add(jLabel4))
                            .add(76, 76, 76)
                            .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(powerLawSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167,
                                            Short.MAX_VALUE)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, terrainSeedSpinner,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, baseHeightSpinner,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, terrainTypeCombo,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 167,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton1)).addContainerGap()));
    basicPanelLayout.setVerticalGroup(basicPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(basicPanelLayout.createSequentialGroup().addContainerGap()
                    .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel1).add(terrainTypeCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel2).add(baseHeightSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel3).add(terrainSeedSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel4).add(powerLawSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 146, Short.MAX_VALUE)
                    .add(jButton1).addContainerGap()));
    jTabbedPane2.addTab("Basic", basicPanel);

    subdivisionSpinner.setModel(new SpinnerNumberModel(1, 0, 16, 1));
    subdivisionSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            subdivisionSpinnerStateChanged(evt);
        }
    });

    unperturbedSpinner.setModel(new SpinnerNumberModel(1, 0, 16, 1));
    unperturbedSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            unperturbedSpinnerStateChanged(evt);
        }
    });

    vertPeturbSpinner.setModel(new SpinnerNumberModel(0, 0, 50, 1));
    vertPeturbSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        @Override
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            vertPeturbSpinnerStateChanged(evt);
        }
    });

    horizPeturbSpinner.setModel(new SpinnerNumberModel(0, 0, 25, 1));
    horizPeturbSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        @Override
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            horizPeturbSpinnerStateChanged(evt);
        }
    });

    jLabel5.setText("Total subdivisions");

    jLabel6.setText("Unperturbed subdivisions");

    jLabel7.setText("Vertical peturbation");

    jLabel8.setText("Horizontal peturbation");

    jButton2.setText("Reset");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout subdivPanelLayout = new org.jdesktop.layout.GroupLayout(subdivPanel);
    subdivPanel.setLayout(subdivPanelLayout);
    subdivPanelLayout.setHorizontalGroup(subdivPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(subdivPanelLayout.createSequentialGroup().addContainerGap().add(subdivPanelLayout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(subdivPanelLayout.createSequentialGroup()
                            .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel5).add(jLabel6).add(jLabel7).add(jLabel8))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 118, Short.MAX_VALUE)
                            .add(subdivPanelLayout
                                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(horizPeturbSpinner).add(vertPeturbSpinner).add(unperturbedSpinner)
                                    .add(subdivisionSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 105,
                                            Short.MAX_VALUE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton2)).addContainerGap()));
    subdivPanelLayout.setVerticalGroup(subdivPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(subdivPanelLayout.createSequentialGroup().addContainerGap()
                    .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel5).add(subdivisionSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel6).add(unperturbedSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel7).add(vertPeturbSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel8).add(horizPeturbSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 148, Short.MAX_VALUE)
                    .add(jButton2).addContainerGap()));
    jTabbedPane2.addTab("Subdivision", subdivPanel);

    noiseTermSpinner.setModel(new SpinnerNumberModel(0, 0, 10, 1));
    noiseTermSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            noiseTermSpinnerStateChanged(evt);
        }
    });

    noiseFrequencySpinner.setModel(new SpinnerNumberModel(0, 0, 10000, 10));
    noiseFrequencySpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            noiseFrequencySpinnerStateChanged(evt);
        }
    });

    noiseAmplitudeSpinner.setModel(new SpinnerNumberModel(0, 0, 100, 1));
    noiseAmplitudeSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            noiseAmplitudeSpinnerStateChanged(evt);
        }
    });

    noiseAmplitudeDecaySpinner.setModel(new SpinnerNumberModel(0, 0, 100, 10));
    noiseAmplitudeDecaySpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            noiseAmplitudeDecaySpinnerStateChanged(evt);
        }
    });

    jLabel9.setText("Noise terms");

    jLabel10.setText("Noise frequency");

    jLabel11.setText("Noise amplitude");

    jLabel12.setText("Noise amplitude decay");

    jButton3.setText("Reset");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout noisePanelLayout = new org.jdesktop.layout.GroupLayout(noisePanel);
    noisePanel.setLayout(noisePanelLayout);
    noisePanelLayout.setHorizontalGroup(noisePanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(noisePanelLayout.createSequentialGroup().addContainerGap().add(noisePanelLayout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(noisePanelLayout.createSequentialGroup()
                            .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel9).add(jLabel10).add(jLabel11).add(jLabel12))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 125, Short.MAX_VALUE)
                            .add(noisePanelLayout
                                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(noiseAmplitudeDecaySpinner).add(noiseAmplitudeSpinner)
                                    .add(noiseFrequencySpinner).add(org.jdesktop.layout.GroupLayout.TRAILING,
                                            noiseTermSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                            112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton3)).addContainerGap()));
    noisePanelLayout.setVerticalGroup(noisePanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(noisePanelLayout.createSequentialGroup().addContainerGap()
                    .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel9).add(noiseTermSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel10)
                            .add(noiseFrequencySpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel11).add(noiseAmplitudeSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel12).add(noiseAmplitudeDecaySpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 148, Short.MAX_VALUE)
                    .add(jButton3).addContainerGap()));
    jTabbedPane2.addTab("Noise", noisePanel);

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jTabbedPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jTabbedPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE));
    jTabbedPane1.addTab("Terrain", jPanel1);

    snowEquatorSpinner.setModel(new SpinnerNumberModel(0, -100, 200, 10));
    snowEquatorSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            snowEquatorSpinnerStateChanged(evt);
        }
    });

    snowPoleSpinner.setModel(new SpinnerNumberModel(0, -100, 200, 10));
    snowPoleSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            snowPoleSpinnerStateChanged(evt);
        }
    });

    snowPowerLawSpinner.setModel(new SpinnerNumberModel(1, 1, 1000, 10));
    snowPowerLawSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            snowPowerLawSpinnerStateChanged(evt);
        }
    });

    snowSlopeSpinner.setModel(new SpinnerNumberModel(0, 0, 10000, 5));
    snowSlopeSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            snowSlopeSpinnerStateChanged(evt);
        }
    });

    snowGlacierSpinner.setModel(new SpinnerNumberModel(0, -1000, 1000, 5));
    snowGlacierSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            snowGlacierSpinnerStateChanged(evt);
        }
    });

    jLabel13.setText("Snowline at equator");

    jLabel14.setText("Snowline at pole");

    jLabel15.setText("Snowline power law");

    jLabel16.setText("Snowline slope suppression");

    jLabel17.setText("Snowline glacier effect");

    jButton4.setText("Reset");
    jButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton4ActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout snowPanelLayout = new org.jdesktop.layout.GroupLayout(snowPanel);
    snowPanel.setLayout(snowPanelLayout);
    snowPanelLayout.setHorizontalGroup(snowPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(snowPanelLayout.createSequentialGroup().addContainerGap().add(snowPanelLayout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(snowPanelLayout.createSequentialGroup()
                            .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel13).add(jLabel14).add(jLabel15).add(jLabel16).add(jLabel17))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 115, Short.MAX_VALUE)
                            .add(snowPanelLayout
                                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(snowGlacierSpinner).add(snowSlopeSpinner).add(snowPowerLawSpinner)
                                    .add(snowPoleSpinner).add(snowEquatorSpinner,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 104,
                                            Short.MAX_VALUE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton4)).addContainerGap()));
    snowPanelLayout.setVerticalGroup(snowPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(snowPanelLayout.createSequentialGroup().addContainerGap()
                    .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel13).add(snowEquatorSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel14).add(snowPoleSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel15).add(snowPowerLawSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel16).add(snowSlopeSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel17).add(snowGlacierSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 147, Short.MAX_VALUE)
                    .add(jButton4).addContainerGap()));
    jTabbedPane1.addTab("Snow", snowPanel);

    riverSpinner.setModel(new SpinnerNumberModel(0, 0, 1000000, 100));
    riverSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            riverSpinnerStateChanged(evt);
        }
    });

    riverSeedSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            riverSeedSpinnerStateChanged(evt);
        }
    });

    riverLakeSeaSpinner.setModel(new SpinnerNumberModel(1, 1, 100, 1));
    riverLakeSeaSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            riverLakeSeaSpinnerStateChanged(evt);
        }
    });

    jLabel18.setText("Number of rivers");

    jLabel19.setText("River random seed");

    jLabel20.setText("Lake becomes sea");

    jButton5.setText("Reset");
    jButton5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton5ActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout riverPanelLayout = new org.jdesktop.layout.GroupLayout(riverPanel);
    riverPanel.setLayout(riverPanelLayout);
    riverPanelLayout.setHorizontalGroup(riverPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(riverPanelLayout.createSequentialGroup().addContainerGap().add(riverPanelLayout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(riverPanelLayout.createSequentialGroup()
                            .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel18).add(jLabel19).add(jLabel20))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 155, Short.MAX_VALUE)
                            .add(riverPanelLayout
                                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(riverLakeSeaSpinner).add(riverSeedSpinner).add(riverSpinner,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 104,
                                            Short.MAX_VALUE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton5)).addContainerGap()));
    riverPanelLayout.setVerticalGroup(riverPanelLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(riverPanelLayout.createSequentialGroup().addContainerGap()
                    .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel18).add(riverSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel19).add(riverSeedSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel20).add(riverLakeSeaSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 199, Short.MAX_VALUE)
                    .add(jButton5).addContainerGap()));
    jTabbedPane1.addTab("Rivers", riverPanel);

    colourResetButton.setText("Reset");
    colourResetButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            colourResetButtonActionPerformed(evt);
        }
    });

    jLabel21.setText("Colour of low terrain");

    jLabel22.setText("Colour of high terrain");

    jLabel23.setText("Colour of ocean");

    jLabel24.setText("Colour of rivers");

    jLabel25.setText("Colour of shoreline");

    jLabel26.setText("Colour of snow");

    lowTerrainButton.setText("Select ...");
    lowTerrainButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            lowTerrainButtonActionPerformed(evt);
        }
    });

    highTerrainButton.setText("Select ...");
    highTerrainButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            highTerrainButtonActionPerformed(evt);
        }
    });

    oceanButton.setText("Select ...");
    oceanButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            oceanButtonActionPerformed(evt);
        }
    });

    riverButton.setText("Select ...");
    riverButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            riverButtonActionPerformed(evt);
        }
    });

    shorelineButton.setText("Select ...");
    shorelineButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            shorelineButtonActionPerformed(evt);
        }
    });

    snowButton.setText("Select ...");
    snowButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            snowButtonActionPerformed(evt);
        }
    });

    saveColoursButton.setText("Save ...");
    saveColoursButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveColoursButtonActionPerformed(evt);
        }
    });

    loadColoursButton.setText("Load ...");
    loadColoursButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            loadColoursButtonActionPerformed(evt);
        }
    });

    jLabel27.setText("Oceans and rivers emissive");

    oceansEmissiveSpinner.setModel(new SpinnerNumberModel(0, 0, 100, 5));
    oceansEmissiveSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            oceansEmissiveSpinnerStateChanged(evt);
        }
    });

    org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup().addContainerGap().add(jPanel2Layout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel26).add(jLabel24)
                    .add(jLabel22).add(jLabel21).add(jLabel25).add(jLabel23)
                    .add(jPanel2Layout.createSequentialGroup().add(saveColoursButton)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(loadColoursButton))
                    .add(jLabel27))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 34, Short.MAX_VALUE)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, snowButton,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, riverButton,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, oceanButton,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, highTerrainButton,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(lowTerrainButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 163,
                                    Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, shorelineButton,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, oceansEmissiveSpinner)
                            .add(colourResetButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(lowTerrainButton).add(jLabel21))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(highTerrainButton).add(jLabel22))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(oceanButton).add(jLabel23))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(riverButton).add(jLabel24))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(shorelineButton))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(snowButton).add(jLabel26))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel27).add(oceansEmissiveSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 77, Short.MAX_VALUE)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(colourResetButton)
                            .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(saveColoursButton).add(loadColoursButton)))
                    .addContainerGap()));
    jTabbedPane1.addTab("Colours", jPanel2);

    enableCloudsCheckbox.setText("Enable clouds");
    enableCloudsCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    enableCloudsCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    enableCloudsCheckbox.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            enableCloudsCheckboxStateChanged(evt);
        }
    });

    cloudsSubdivisionsCheckbox.setText("Use own subdivisions");
    cloudsSubdivisionsCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    cloudsSubdivisionsCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    cloudsSubdivisionsCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cloudsSubdivisionsCheckboxActionPerformed(evt);
        }
    });
    cloudsSubdivisionsCheckbox.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            cloudsSubdivisionsCheckboxStateChanged(evt);
        }
    });

    cloudsSubdivisionSpinner.setModel(new SpinnerNumberModel(1, 0, 16, 1));
    cloudsSubdivisionSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            cloudsSubdivisionSpinnerStateChanged(evt);
        }
    });

    jLabel35.setText("Clouds random seed");

    cloudsSeedSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            cloudsSeedSpinnerStateChanged(evt);
        }
    });

    jLabel36.setText("Cloud colour");

    cloudButton.setText("Select ...");
    cloudButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cloudButtonActionPerformed(evt);
        }
    });

    resetCloudsButton.setText("Reset");
    resetCloudsButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetCloudsButtonActionPerformed(evt);
        }
    });

    jLabel37.setText("Cloud height");

    cloudsHeightSpinner.setModel(new SpinnerNumberModel(1, 1, 100, 1));
    cloudsHeightSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            cloudsHeightSpinnerStateChanged(evt);
        }
    });

    org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel8Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(enableCloudsCheckbox)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, resetCloudsButton)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING,
                                    jPanel8Layout.createSequentialGroup().add(jLabel36).add(123, 123, 123).add(
                                            cloudButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167,
                                            Short.MAX_VALUE))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout
                                    .createSequentialGroup()
                                    .add(jPanel8Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(jLabel35).add(cloudsSubdivisionsCheckbox).add(jLabel37))
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 63,
                                            Short.MAX_VALUE)
                                    .add(jPanel8Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                            .add(cloudsHeightSpinner).add(cloudsSubdivisionSpinner)
                                            .add(cloudsSeedSpinner,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167,
                                                    Short.MAX_VALUE))))
                    .addContainerGap()));
    jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel8Layout.createSequentialGroup().addContainerGap().add(enableCloudsCheckbox)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(cloudsSubdivisionsCheckbox).add(cloudsSubdivisionSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(cloudsSeedSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel35))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(cloudsHeightSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel37))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(cloudButton).add(jLabel36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 149, Short.MAX_VALUE)
                    .add(resetCloudsButton).addContainerGap()));
    jTabbedPane1.addTab("Clouds", jPanel8);

    jLabel30.setText("Sunlight colour setting");

    sunlightButton.setText("Select ...");
    sunlightButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            sunlightButtonActionPerformed(evt);
        }
    });

    sunXSlider.setMajorTickSpacing(50);
    sunXSlider.setMinimum(-100);
    sunXSlider.setMinorTickSpacing(25);
    sunXSlider.setPaintLabels(true);
    sunXSlider.setPaintTicks(true);
    sunXSlider.setValue(0);
    sunXSlider.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            sunXSliderStateChanged(evt);
        }
    });

    sunYSlider.setMajorTickSpacing(50);
    sunYSlider.setMinimum(-100);
    sunYSlider.setMinorTickSpacing(25);
    sunYSlider.setPaintLabels(true);
    sunYSlider.setPaintTicks(true);
    sunYSlider.setValue(0);
    sunYSlider.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            sunYSliderStateChanged(evt);
        }
    });

    sunZSlider.setMajorTickSpacing(50);
    sunZSlider.setMinimum(-100);
    sunZSlider.setMinorTickSpacing(25);
    sunZSlider.setPaintLabels(true);
    sunZSlider.setPaintTicks(true);
    sunZSlider.setValue(0);
    sunZSlider.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            sunZSliderStateChanged(evt);
        }
    });

    jLabel31.setLabelFor(sunXSlider);
    jLabel31.setText("Sun X Location");

    jLabel32.setText("Sun Y Location");

    jLabel33.setText("Sun Z Location");

    resetSunlightButton.setText("Reset");
    resetSunlightButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetSunlightButtonActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
    jPanel6.setLayout(jPanel6Layout);
    jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, resetSunlightButton)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING,
                                    jPanel6Layout.createSequentialGroup().add(jLabel30)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 75,
                                                    Short.MAX_VALUE)
                                            .add(sunlightButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                                    163, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(jPanel6Layout.createSequentialGroup()
                                    .add(jPanel6Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(jLabel32).add(jLabel33).add(jLabel31))
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                    .add(jPanel6Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(sunXSlider, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270,
                                                    Short.MAX_VALUE)
                                            .add(org.jdesktop.layout.GroupLayout.TRAILING, sunZSlider,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270,
                                                    Short.MAX_VALUE)
                                            .add(sunYSlider, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270,
                                                    Short.MAX_VALUE))))
                    .addContainerGap()));
    jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(sunlightButton).add(jLabel30))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel31).add(sunXSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel32).add(sunYSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel33).add(sunZSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 67, Short.MAX_VALUE)
                    .add(resetSunlightButton).addContainerGap()));
    jTabbedPane3.addTab("Sun", jPanel6);

    fogButton.setText("Select ...");
    fogButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fogButtonActionPerformed(evt);
        }
    });

    jLabel34.setText("Ambient light intensity");

    ambientSpinner.setModel(new SpinnerNumberModel(1.0, 0.0, 1.0, 0.001));
    ambientSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            ambientSpinnerStateChanged(evt);
        }
    });

    resetAmbientButton.setText("Reset");
    resetAmbientButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetAmbientButtonActionPerformed(evt);
        }
    });

    enableFogCheckbox.setText("Enable fog");
    enableFogCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    enableFogCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    enableFogCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            enableFogCheckboxActionPerformed(evt);
        }
    });

    jLabel29.setText("Fog distance");

    fogDistanceSpinner.setModel(new SpinnerNumberModel(0, 0, 1000, 1));
    fogDistanceSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            fogDistanceSpinnerStateChanged(evt);
        }
    });

    org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
    jPanel7.setLayout(jPanel7Layout);
    jPanel7Layout.setHorizontalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel7Layout.createSequentialGroup().addContainerGap().add(jPanel7Layout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, resetAmbientButton)
                    .add(jPanel7Layout.createSequentialGroup()
                            .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(enableFogCheckbox).add(jLabel34).add(jLabel29))
                            .add(25, 25, 25)
                            .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(fogDistanceSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213,
                                            Short.MAX_VALUE)
                                    .add(ambientSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213,
                                            Short.MAX_VALUE)
                                    .add(fogButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213,
                                            Short.MAX_VALUE))))
                    .addContainerGap()));
    jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel7Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel34).add(ambientSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(fogButton).add(enableFogCheckbox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel29).add(fogDistanceSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 171, Short.MAX_VALUE)
                    .add(resetAmbientButton).addContainerGap()));
    jTabbedPane3.addTab("Ambient", jPanel7);

    resetRenderButton.setText("Reset");
    resetRenderButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetRenderButtonActionPerformed(evt);
        }
    });

    wireframeCheckbox.setText("Wireframe rendering only");
    wireframeCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    wireframeCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    wireframeCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            wireframeCheckboxActionPerformed(evt);
        }
    });

    displayListCheckbox.setText("Use an OpenGL display list for rendering");
    displayListCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    displayListCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    displayListCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            displayListCheckboxActionPerformed(evt);
        }
    });

    nvidiaHackCheckbox.setText("Disable glDeleteList() for Linux / NVIDIA issue");
    nvidiaHackCheckbox.setToolTipText("Turning this off Linux with nvidia GL may crash the program");
    nvidiaHackCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    nvidiaHackCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    nvidiaHackCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            nvidiaHackCheckboxActionPerformed(evt);
        }
    });

    framesPerSecondSpinner.setModel(new SpinnerNumberModel(50, 1, 100, 1));
    framesPerSecondSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            framesPerSecondSpinnerStateChanged(evt);
        }
    });

    jLabel28.setText("Target frames per second");

    org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(wireframeCheckbox)
                    .addContainerGap(215, Short.MAX_VALUE))
            .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(displayListCheckbox)
                    .addContainerGap(145, Short.MAX_VALUE))
            .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(nvidiaHackCheckbox)
                    .addContainerGap(119, Short.MAX_VALUE))
            .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(jLabel28)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(framesPerSecondSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 82,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(144, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
                    .addContainerGap(291, Short.MAX_VALUE).add(resetRenderButton).addContainerGap()));
    jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(wireframeCheckbox)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(displayListCheckbox)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(nvidiaHackCheckbox)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel28).add(framesPerSecondSpinner,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(135, 135, 135).add(resetRenderButton).addContainerGap()));
    jTabbedPane3.addTab("Options", jPanel4);

    org.jdesktop.layout.GroupLayout renderPanelLayout = new org.jdesktop.layout.GroupLayout(renderPanel);
    renderPanel.setLayout(renderPanelLayout);
    renderPanelLayout
            .setHorizontalGroup(renderPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jTabbedPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE));
    renderPanelLayout
            .setVerticalGroup(renderPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jTabbedPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE));
    jTabbedPane1.addTab("Render", null, renderPanel, "Options affecting rendering");

    exportSeaCheckbox.setText("Export sea as object rather than triangles");
    exportSeaCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    exportSeaCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    exportSeaCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exportSeaCheckboxActionPerformed(evt);
        }
    });

    exportAtmosphereCheckbox.setText("Output an atmosphere object");
    exportAtmosphereCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    exportAtmosphereCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    exportAtmosphereCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exportAtmosphereCheckboxActionPerformed(evt);
        }
    });

    excludeAlternateCheckbox.setText("Exclude alternate colour triangles");
    excludeAlternateCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    excludeAlternateCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    excludeAlternateCheckbox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            excludeAlternateCheckboxActionPerformed(evt);
        }
    });

    resetExportButton.setText("Reset");
    resetExportButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            resetExportButtonActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(exportSeaCheckbox).add(exportAtmosphereCheckbox).add(excludeAlternateCheckbox))
                    .addContainerGap(140, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup()
                    .addContainerGap(296, Short.MAX_VALUE).add(resetExportButton).addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup().addContainerGap().add(exportSeaCheckbox)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(exportAtmosphereCheckbox)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(excludeAlternateCheckbox)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 214, Short.MAX_VALUE)
                    .add(resetExportButton).addContainerGap()));
    jTabbedPane1.addTab("Export", jPanel3);

    verticesLabel.setText("jLabel29");

    trianglesLabel.setText("jLabel30");

    landTriangleLabel.setText("jLabel29");

    seaTriangleLabel.setText("jLabel30");

    org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(verticesLabel).add(trianglesLabel).add(landTriangleLabel)
                            .add(seaTriangleLabel))
                    .addContainerGap(319, Short.MAX_VALUE)));
    jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup().addContainerGap().add(verticesLabel)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(trianglesLabel)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(landTriangleLabel)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(seaTriangleLabel)
                    .addContainerGap(231, Short.MAX_VALUE)));
    jTabbedPane1.addTab("Stats", jPanel5);

    regenCloudsButton.setAction(new RegenCloudsAction("RegenClouds"));
    regenCloudsButton.setText("... with new clouds seed");

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(regenRiverButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)
            .add(regenButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)
            .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)
            .add(regenTerrainButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)
            .add(regenCloudsButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                    .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenButton)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenRiverButton)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenTerrainButton)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenCloudsButton)));
    pack();
}

From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java

private int FillPolymerComboBox(JComboBox comboBox, int id) {
    int result = -1;
    List<Polymer> polymers = this.polymerService.GetAllEntities();
    if (polymers.size() > 0) {
        List<ComboBoxItem<Polymer>> polymerNames = polymers
                .stream().sorted(comparing(x -> x.getGrade())).map(x -> ComboBoxItemConvertor
                        .ConvertToComboBoxItem(x, x.getGrade() + " / " + x.getCompany(), x.getId()))
                .collect(Collectors.toList());
        Polymer polymer = new Polymer();
        polymer.setId(0);//from  ww  w  .j  av  a2  s  . com
        polymer.setCompany("- Select -");
        polymerNames.add(0, new ComboBoxItem<Polymer>(polymer, polymer.getCompany(), polymer.getId()));
        ComboBoxItem[] polymerNamesArray = polymerNames.toArray(new ComboBoxItem[polymerNames.size()]);
        comboBox.setModel(new DefaultComboBoxModel(polymerNamesArray));
        if (id != 0) {
            ComboBoxItem<Polymer> currentPolymerName = polymerNames.stream().filter(x -> x.getId() == id)
                    .findFirst().get();
            result = polymerNames.indexOf(currentPolymerName);
        } else {
            result = 0;
        }
        comboBox.setSelectedIndex(result);
    }
    return result;
}

From source file:dataviewer.DataViewer.java

private void cb_tableFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cb_tableFocusGained
    List<String> files = Utilities.getAllFileNames("./db", false);
    String[] cols = new String[files.size()];
    int i = 0;//from w  ww  .j ava  2s. com
    for (String f : files) {
        cols[i++] = f.replace(getExtension(f), "");
    }
    DefaultComboBoxModel model = new DefaultComboBoxModel(cols);
    cb_table.setModel(model);
    cb_table.showPopup();
}

From source file:de.tor.tribes.ui.views.DSWorkbenchTroopsFrame.java

private void addTroopsManuallyEvent() {
    HashMap<Integer, Tribe> tribes = DataHolder.getSingleton().getTribes();

    List<Tribe> tribesList = new LinkedList<>();
    for (Tribe t : tribes.values()) {
        tribesList.add(t);//from   w w w  .  j  a v  a2 s .  c o m
    }
    Collections.sort(tribesList, Tribe.CASE_INSENSITIVE_ORDER);

    DefaultComboBoxModel model = new DefaultComboBoxModel(tribesList.toArray(new Tribe[tribesList.size()]));
    jTroopAddTribe.setModel(model);
    model.setSelectedItem(GlobalOptions.getSelectedProfile().getTribe());
    jTroopsAddDialog.setLocationRelativeTo(DSWorkbenchTroopsFrame.this);
    jTroopsAddDialog.setVisible(true);
}

From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java

private int FillAdditiveComboBox(JComboBox comboBox, int id) {
    int result = -1;
    List<Additive> additives = this.additiveService.GetAllEntities();
    if (additives.size() > 0) {
        List<ComboBoxItem<Additive>> additiveNames = additives
                .stream().sorted(comparing(x -> x.getGrade())).map(x -> ComboBoxItemConvertor
                        .ConvertToComboBoxItem(x, x.getGrade() + " / " + x.getCompany(), x.getId()))
                .collect(Collectors.toList());
        Additive additive = new Additive();
        additive.setId(0);//from  www  . j  ava  2s . c o m
        additive.setCompany("- Select -");
        additiveNames.add(0, new ComboBoxItem<Additive>(additive, additive.getCompany(), additive.getId()));
        ComboBoxItem[] additiveNamesArray = additiveNames.toArray(new ComboBoxItem[additiveNames.size()]);
        comboBox.setModel(new DefaultComboBoxModel(additiveNamesArray));
        if (id != 0) {
            ComboBoxItem<Additive> currentAdditiveName = additiveNames.stream().filter(x -> x.getId() == id)
                    .findFirst().get();
            result = additiveNames.indexOf(currentAdditiveName);
        } else {
            result = 0;
        }
        comboBox.setSelectedIndex(result);
    }
    return result;
}

From source file:edu.ku.brc.specify.tasks.subpane.qb.QueryFieldPanel.java

/**
 * @param fqri//from ww  w. j  ava 2 s . c om
 * @param qf
 * 
 * Sets new field and updates UI to display properties for new field.
 */
public void setField(final FieldQRI fqri, final SpQueryField qf) {
    fieldQRI = fqri;
    if (fieldQRI != null && (fieldQRI.getDataClass().equals(Calendar.class)
            || fieldQRI.getDataClass().equals(java.sql.Timestamp.class))) {
        dateConverter = new DateConverter();
    }

    if (fieldQRI != null) {
        icon = IconManager.getIcon(fieldQRI.getTableInfo().getName(), iconSize);
        setIcon(icon);
    }

    pickList = buildPickList();
    comparators = getComparatorList(fieldQRI);
    String fieldLabelText = fieldQRI != null ? fieldQRI.getTitle() : null;
    if (fieldQRI instanceof RelQRI) {
        DBRelationshipInfo.RelationshipType relType = ((RelQRI) fieldQRI).getRelationshipInfo().getType();
        if (relType.equals(DBRelationshipInfo.RelationshipType.OneToMany)
                || relType.equals(DBRelationshipInfo.RelationshipType.ManyToMany)) {
            fieldLabelText += " " + UIRegistry.getResourceString("QB_AGGREGATED");
        } else {
            fieldLabelText += " " + UIRegistry.getResourceString("QB_FORMATTED");
        }

    }
    fieldLabel.setText(fieldLabelText);
    boolean isBool = fieldQRI != null && fieldQRI.getDataClass().equals(Boolean.class);
    boolean isRel = fieldQRI != null && fieldQRI instanceof RelQRI;
    boolean isTreeLevel = fieldQRI instanceof TreeLevelQRI;

    operatorCBX.setModel(new DefaultComboBoxModel(comparators));
    //XXX need to set up criteria to support 'between' if necessary

    for (int c = 1; c < comps.length; c++) {
        if (comps[c] != null) {
            comps[c].setVisible(fieldQRI != null);
        }
    }

    isNotCheckbox.setVisible(fieldQRI != null && !isRel);
    operatorCBX.setVisible(fieldQRI != null && !isRel);
    criteria.setVisible(fieldQRI != null && !isRel && !isBool);
    if (schemaMapping != null) {
        this.sortCheckbox.setVisible(!(isTreeLevel || isRel));
    } else {
        if (!isRel) {
            this.sortCheckbox.setVisible(fieldQRI != null);
        } else {
            this.sortCheckbox.setVisible(
                    ((RelQRI) fieldQRI).getRelationshipInfo().getType() != RelationshipType.OneToMany);
        }
    }

    if (schemaMapping != null) {
        isPromptCkbx.setVisible(false);
    } else if (!ownerQuery.isPromptMode()) {
        isDisplayedCkbx.setVisible(fieldQRI != null && !isRel);
        isPromptCkbx.setVisible(fieldQRI != null && !isRel);
        isEnforcedCkbx.setVisible(fieldQRI != null && !isRel);
    }
    setQueryField(qf);
}

From source file:jeplus.gui.JPanel_TrnsysProjectFiles.java

private void cmdSelectRVIFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdSelectRVIFileActionPerformed
    // Select a file to open
    if (this.chkReadVar.isSelected()) {
        MainGUI.getFileChooser().setFileFilter(EPlusConfig.getFileFilter(EPlusConfig.RVX));
    } else {//from   w  ww.ja  v  a2 s . co m
        MainGUI.getFileChooser().setFileFilter(EPlusConfig.getFileFilter(EPlusConfig.RVI));
    }
    MainGUI.getFileChooser().setMultiSelectionEnabled(false);
    MainGUI.getFileChooser().setSelectedFile(new File(""));
    String rvidir = RelativeDirUtil.checkAbsolutePath(txtRviDir.getText(), Project.getBaseDir());
    MainGUI.getFileChooser().setCurrentDirectory(new File(rvidir));
    if (MainGUI.getFileChooser().showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        File file = MainGUI.getFileChooser().getSelectedFile();
        String dir = file.getParent() + File.separator;
        String reldir = RelativeDirUtil.getRelativePath(dir, Project.getBaseDir(), "/");
        txtRviDir.setText(reldir);
        String name = file.getName();
        cboRviFile.setModel(new DefaultComboBoxModel(new String[] { name }));
        Project.setRVIDir(reldir);
        Project.setRVIFile(name);
    }
    MainGUI.getFileChooser().resetChoosableFileFilters();
    MainGUI.getFileChooser().setSelectedFile(new File(""));
    // TODO add your handling code here:
}

From source file:de.bfs.radon.omsimulation.gui.OMPanelResults.java

/**
 * Initialises the interface of the results panel.
 *//*from   w w w.j  a v a2 s  . c o m*/
protected void initialize() {
    setLayout(null);

    lblExportChartTo = new JLabel("Export chart to ...");
    lblExportChartTo.setBounds(436, 479, 144, 14);
    lblExportChartTo.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblExportChartTo.setVisible(false);
    add(lblExportChartTo);

    btnMaximize = new JButton("Fullscreen");
    btnMaximize.setBounds(10, 475, 124, 23);
    btnMaximize.setFont(new Font("SansSerif", Font.PLAIN, 11));
    btnMaximize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (comboBoxSimulations.isEnabled()) {
                if (comboBoxSimulations.getSelectedItem() != null) {
                    JFrame chartFrame = new JFrame();
                    OMSimulation simulation = (OMSimulation) comboBoxSimulations.getSelectedItem();
                    String title = simulation.toString();
                    DescriptiveStatistics statistics = null;
                    OMStatistics statisticsType = (OMStatistics) comboBoxStatistics.getSelectedItem();
                    OMRoomType roomType = null;
                    switch (statisticsType) {
                    case RoomArithmeticMeans:
                        title = "R_AM, " + title;
                        statistics = simulation.getRoomAmDescriptiveStats();
                        roomType = OMRoomType.Room;
                        break;
                    case RoomGeometricMeans:
                        title = "R_GM, " + title;
                        statistics = simulation.getRoomGmDescriptiveStats();
                        roomType = OMRoomType.Room;
                        break;
                    case RoomMedianQ50:
                        title = "R_MED, " + title;
                        statistics = simulation.getRoomMedDescriptiveStats();
                        roomType = OMRoomType.Room;
                        break;
                    case RoomMaxima:
                        title = "R_MAX, " + title;
                        statistics = simulation.getRoomMaxDescriptiveStats();
                        roomType = OMRoomType.Room;
                        break;
                    case CellarArithmeticMeans:
                        title = "C_AM, " + title;
                        statistics = simulation.getCellarAmDescriptiveStats();
                        roomType = OMRoomType.Cellar;
                        break;
                    case CellarGeometricMeans:
                        title = "C_GM, " + title;
                        statistics = simulation.getCellarGmDescriptiveStats();
                        roomType = OMRoomType.Cellar;
                        break;
                    case CellarMedianQ50:
                        title = "C_MED, " + title;
                        statistics = simulation.getCellarMedDescriptiveStats();
                        roomType = OMRoomType.Cellar;
                        break;
                    case CellarMaxima:
                        title = "C_MAX, " + title;
                        statistics = simulation.getCellarMaxDescriptiveStats();
                        roomType = OMRoomType.Cellar;
                        break;
                    default:
                        title = "R_AM, " + title;
                        statistics = simulation.getRoomAmDescriptiveStats();
                        roomType = OMRoomType.Misc;
                        break;
                    }
                    JPanel chartPanel = createDistributionPanel(title, statistics, roomType, false, true, true);
                    chartFrame.getContentPane().add(chartPanel);
                    chartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
                    chartFrame.setBounds(0, 0, (int) dim.getWidth(), (int) dim.getHeight());
                    chartFrame.setTitle("OM Simulation Tool: " + title);
                    chartFrame.setResizable(true);
                    chartFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                    chartFrame.setVisible(true);
                }
            }
        }
    });
    add(btnMaximize);

    btnCsv = new JButton("CSV");
    btnCsv.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.csv", "csv"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String csv;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("csv")) {
                    csv = "";
                } else {
                    csv = ".csv";
                }
                String csvPath = file.getAbsolutePath() + csv;
                OMSimulation simulation = (OMSimulation) comboBoxSimulations.getSelectedItem();
                OMCampaign[] campaigns = simulation.getCampaigns();
                File csvFile = new File(csvPath);
                try {
                    FileWriter logWriter = new FileWriter(csvFile);
                    BufferedWriter csvOutput = new BufferedWriter(logWriter);
                    OMStatistics statisticsType = (OMStatistics) comboBoxStatistics.getSelectedItem();
                    String head = "";
                    switch (statisticsType) {
                    case RoomArithmeticMeans:
                        head = "R_AM";
                        break;
                    case RoomGeometricMeans:
                        head = "R_GM";
                        break;
                    case RoomMedianQ50:
                        head = "R_MED";
                        break;
                    case RoomMaxima:
                        head = "R_MAX";
                        break;
                    case CellarArithmeticMeans:
                        head = "C_AM";
                        break;
                    case CellarGeometricMeans:
                        head = "C_GM";
                        break;
                    case CellarMedianQ50:
                        head = "C_MED";
                        break;
                    case CellarMaxima:
                        head = "C_MAX";
                        break;
                    default:
                        head = "R_AM";
                        break;
                    }
                    csvOutput.write("\"ID\";\"CAMPAIGN\";\"START\";\"" + head + "\"");
                    csvOutput.newLine();
                    int value = 0;
                    for (int i = 0; i < campaigns.length; i++) {
                        switch (statisticsType) {
                        case RoomArithmeticMeans:
                            value = (int) campaigns[i].getRoomAverage();
                            break;
                        case RoomGeometricMeans:
                            value = (int) campaigns[i].getRoomLogAverage();
                            break;
                        case RoomMedianQ50:
                            value = (int) campaigns[i].getRoomMedian();
                            break;
                        case RoomMaxima:
                            value = (int) campaigns[i].getRoomMaximum();
                            break;
                        case CellarArithmeticMeans:
                            value = (int) campaigns[i].getCellarAverage();
                            break;
                        case CellarGeometricMeans:
                            value = (int) campaigns[i].getCellarLogAverage();
                            break;
                        case CellarMedianQ50:
                            value = (int) campaigns[i].getCellarMedian();
                            break;
                        case CellarMaxima:
                            value = (int) campaigns[i].getCellarMaximum();
                            break;
                        default:
                            value = (int) campaigns[i].getRoomAverage();
                            break;
                        }
                        csvOutput.write("\"" + i + "\";\"" + campaigns[i].getVariation() + "\";\""
                                + campaigns[i].getStart() + "\";\"" + value + "\"");
                        csvOutput.newLine();
                    }
                    JOptionPane.showMessageDialog(null, "CSV saved successfully!\n" + csvPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                    csvOutput.close();
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write CSV. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write CSV. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnCsv.setBounds(590, 475, 70, 23);
    btnCsv.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnCsv.setVisible(false);
    add(btnCsv);

    btnPdf = new JButton("PDF");
    btnPdf.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.pdf", "pdf"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String pdf;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("pdf")) {
                    pdf = "";
                } else {
                    pdf = ".pdf";
                }
                String pdfPath = file.getAbsolutePath() + pdf;
                OMSimulation simulation = (OMSimulation) comboBoxSimulations.getSelectedItem();
                String title = simulation.toString();
                DescriptiveStatistics statistics = null;
                OMStatistics statisticsType = (OMStatistics) comboBoxStatistics.getSelectedItem();
                OMRoomType roomType = null;
                switch (statisticsType) {
                case RoomArithmeticMeans:
                    title = "R_AM, " + title;
                    statistics = simulation.getRoomAmDescriptiveStats();
                    roomType = OMRoomType.Room;
                    break;
                case RoomGeometricMeans:
                    title = "R_GM, " + title;
                    statistics = simulation.getRoomGmDescriptiveStats();
                    roomType = OMRoomType.Room;
                    break;
                case RoomMedianQ50:
                    title = "R_MED, " + title;
                    statistics = simulation.getRoomMedDescriptiveStats();
                    roomType = OMRoomType.Room;
                    break;
                case RoomMaxima:
                    title = "R_MAX, " + title;
                    statistics = simulation.getRoomMaxDescriptiveStats();
                    roomType = OMRoomType.Room;
                    break;
                case CellarArithmeticMeans:
                    title = "C_AM, " + title;
                    statistics = simulation.getCellarAmDescriptiveStats();
                    roomType = OMRoomType.Cellar;
                    break;
                case CellarGeometricMeans:
                    title = "C_GM, " + title;
                    statistics = simulation.getCellarGmDescriptiveStats();
                    roomType = OMRoomType.Cellar;
                    break;
                case CellarMedianQ50:
                    title = "C_MED, " + title;
                    statistics = simulation.getCellarMedDescriptiveStats();
                    roomType = OMRoomType.Cellar;
                    break;
                case CellarMaxima:
                    title = "C_MAX, " + title;
                    statistics = simulation.getCellarMaxDescriptiveStats();
                    roomType = OMRoomType.Cellar;
                    break;
                default:
                    title = "R_AM, " + title;
                    statistics = simulation.getRoomAmDescriptiveStats();
                    roomType = OMRoomType.Misc;
                    break;
                }
                JFreeChart chart = OMCharts.createDistributionChart(title, statistics, roomType, false);
                int height = (int) PageSize.A4.getWidth();
                int width = (int) PageSize.A4.getHeight();
                try {
                    OMExports.exportPdf(pdfPath, chart, width, height, new DefaultFontMapper(), title);
                    JOptionPane.showMessageDialog(null, "PDF saved successfully!\n" + pdfPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write PDF. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write PDF. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnPdf.setBounds(670, 475, 70, 23);
    btnPdf.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnPdf.setVisible(false);
    add(btnPdf);

    lblSelectSimulation = new JLabel("Select Simulation");
    lblSelectSimulation.setFont(new Font("SansSerif", Font.PLAIN, 11));
    lblSelectSimulation.setBounds(10, 65, 132, 14);
    add(lblSelectSimulation);

    lblSelectStatistics = new JLabel("Select Statistics");
    lblSelectStatistics.setFont(new Font("SansSerif", Font.PLAIN, 11));
    lblSelectStatistics.setBounds(10, 94, 132, 14);
    add(lblSelectStatistics);

    comboBoxSimulations = new JComboBox<OMSimulation>();
    comboBoxSimulations.setFont(new Font("SansSerif", Font.PLAIN, 11));
    comboBoxSimulations.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent arg0) {
            boolean b = false;
            if (comboBoxSimulations.isEnabled()) {
                if (comboBoxSimulations.getSelectedItem() != null) {
                    b = true;
                    comboBoxStatistics.removeAllItems();
                    comboBoxStatistics.setModel(new DefaultComboBoxModel<OMStatistics>(OMStatistics.values()));
                } else {
                    b = false;
                    comboBoxStatistics.removeAllItems();
                }
            } else {
                b = false;
                comboBoxStatistics.removeAllItems();
            }
            progressBar.setEnabled(b);
            btnPdf.setVisible(b);
            btnCsv.setVisible(b);
            btnMaximize.setVisible(b);
            lblExportChartTo.setVisible(b);
            comboBoxStatistics.setEnabled(b);
            lblSelectStatistics.setEnabled(b);
        }
    });
    comboBoxSimulations.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            boolean b = false;
            if (comboBoxSimulations.isEnabled()) {
                if (comboBoxSimulations.getSelectedItem() != null) {
                    b = true;
                    comboBoxStatistics.removeAllItems();
                    comboBoxStatistics.setModel(new DefaultComboBoxModel<OMStatistics>(OMStatistics.values()));
                    comboBoxStatistics.setSelectedIndex(0);
                } else {
                    b = false;
                    comboBoxStatistics.removeAllItems();
                }
            } else {
                b = false;
                comboBoxStatistics.removeAllItems();
            }
            progressBar.setEnabled(b);
            btnPdf.setVisible(b);
            btnCsv.setVisible(b);
            btnMaximize.setVisible(b);
            lblExportChartTo.setVisible(b);
            comboBoxStatistics.setEnabled(b);
            lblSelectStatistics.setEnabled(b);
        }
    });
    comboBoxSimulations.setBounds(152, 61, 454, 22);
    add(comboBoxSimulations);

    btnRefresh = new JButton("Load");
    btnRefresh.setFont(new Font("SansSerif", Font.PLAIN, 11));
    btnRefresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (txtOmsFile.getText() != null && !txtOmsFile.getText().equals("")
                    && !txtOmsFile.getText().equals(" ")) {
                txtOmsFile.setBackground(Color.WHITE);
                String omsPath = txtOmsFile.getText();
                String oms;
                String[] tmpFileName = omsPath.split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("oms")) {
                    oms = "";
                } else {
                    oms = ".oms";
                }
                txtOmsFile.setText(omsPath + oms);
                setOmsFile(omsPath + oms);
                File omsFile = new File(omsPath + oms);
                if (omsFile.exists()) {
                    txtOmsFile.setBackground(Color.WHITE);
                    btnRefresh.setEnabled(false);
                    comboBoxSimulations.setEnabled(false);
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    progressBar.setStringPainted(true);
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                    btnPdf.setVisible(false);
                    btnCsv.setVisible(false);
                    btnMaximize.setVisible(false);
                    lblExportChartTo.setVisible(false);
                    refreshSimulationsTask = new RefreshSimulations();
                    refreshSimulationsTask.execute();
                } else {
                    txtOmsFile.setBackground(new Color(255, 222, 222, 128));
                    JOptionPane.showMessageDialog(null, "OMS-file not found, please check the file path!",
                            "Error", JOptionPane.ERROR_MESSAGE);
                }
            } else {
                txtOmsFile.setBackground(new Color(255, 222, 222, 128));
                JOptionPane.showMessageDialog(null, "Please select an OMS-file!", "Warning",
                        JOptionPane.WARNING_MESSAGE);
            }
        }
    });

    comboBoxStatistics = new JComboBox<OMStatistics>();
    comboBoxStatistics.setFont(new Font("SansSerif", Font.PLAIN, 11));
    comboBoxStatistics.setBounds(152, 90, 454, 22);
    comboBoxStatistics.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            updateDistribution();
        }
    });
    add(comboBoxStatistics);

    btnRefresh.setBounds(616, 61, 124, 23);
    add(btnRefresh);

    panelDistribution = new JPanel();
    panelDistribution.setBounds(10, 118, 730, 347);
    add(panelDistribution);

    progressBar = new JProgressBar();
    progressBar.setFont(new Font("SansSerif", Font.PLAIN, 11));
    progressBar.setBounds(10, 475, 730, 23);
    add(progressBar);

    progressBar.setEnabled(false);
    comboBoxStatistics.setEnabled(false);
    lblSelectStatistics.setEnabled(false);
    btnPdf.setVisible(false);
    btnCsv.setVisible(false);
    btnMaximize.setVisible(false);
    lblExportChartTo.setVisible(false);

    lblHelp = new JLabel("Select an OMS-Simulation file to analyse the simulation results and "
            + "display the distribution chart.");
    lblHelp.setForeground(Color.GRAY);
    lblHelp.setFont(new Font("SansSerif", Font.PLAIN, 11));
    lblHelp.setBounds(10, 10, 730, 14);
    add(lblHelp);

    lblSelectOms = new JLabel("Open OMS-File");
    lblSelectOms.setFont(new Font("SansSerif", Font.PLAIN, 11));
    lblSelectOms.setBounds(10, 36, 132, 14);
    add(lblSelectOms);

    txtOmsFile = new JTextField();
    txtOmsFile.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            setOmsFile(txtOmsFile.getText());
        }
    });
    txtOmsFile.setFont(new Font("SansSerif", Font.PLAIN, 11));
    txtOmsFile.setColumns(10);
    txtOmsFile.setBounds(152, 33, 454, 20);
    add(txtOmsFile);

    buttonBrowse = new JButton("Browse");
    buttonBrowse.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.oms", "oms"));
            fileDialog.showOpenDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String oms;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("oms")) {
                    oms = "";
                } else {
                    oms = ".oms";
                }
                txtOmsFile.setText(file.getAbsolutePath() + oms);
                setOmsFile(file.getAbsolutePath() + oms);
            }
        }
    });
    buttonBrowse.setFont(new Font("SansSerif", Font.PLAIN, 11));
    buttonBrowse.setBounds(616, 32, 124, 23);
    add(buttonBrowse);
    progressBar.setVisible(false);
}

From source file:de.tor.tribes.ui.views.DSWorkbenchTroopsFrame.java

private void updateTroopAddVillageList() {
    Tribe t = (Tribe) jTroopAddTribe.getSelectedItem();
    if (t != null) {
        Village[] villageList = t.getVillageList();
        Arrays.sort(villageList);
        jTroopAddVillage.setModel(new DefaultComboBoxModel(villageList));
    } else {/*from   w  ww  .  j a  v  a  2s .  c  o m*/
        jTroopAddVillage.setModel(new DefaultComboBoxModel(new String[] { "Bitte Spieler whlen" }));
    }
}