/* Copyright Nabil Alikhan. 2010.
 * This file is part of BLAST Ring Image Generator (BRIG).
 * BRIG is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * BRIG is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 *  along with BRIG.  If not, see <http://www.gnu.org/licenses/>.
 */

package brig;

import java.awt.image.BufferedImage;
import java.io.File;
import javax.swing.JOptionPane;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
/**
 *
 * @author Nabil
 */
public class CGHeader extends javax.swing.JFrame {

    /** Creates new form CGHeader */
    public CGHeader() {
        initComponents();        
        load();
    }

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

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        jLabel41 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        heightField = new javax.swing.JTextField();
        widthField = new javax.swing.JTextField();
        islinear = new javax.swing.JComboBox();
        showborder = new javax.swing.JComboBox();
        showshading = new javax.swing.JComboBox();
        titleFontSizeField = new javax.swing.JTextField();
        jLabel53 = new javax.swing.JLabel();
        jLabel54 = new javax.swing.JLabel();
        jLabel55 = new javax.swing.JLabel();
        jLabel56 = new javax.swing.JLabel();
        jLabel57 = new javax.swing.JLabel();
        jLabel58 = new javax.swing.JLabel();
        jLabel59 = new javax.swing.JLabel();
        jLabel60 = new javax.swing.JLabel();
        jLabel61 = new javax.swing.JLabel();
        origin = new javax.swing.JComboBox();
        backgroundcolor = new javax.swing.JComboBox();
        bordercolour = new javax.swing.JComboBox();
        titlefontcolour = new javax.swing.JComboBox();
        titlefont = new javax.swing.JComboBox();
        titlefontstyle = new javax.swing.JComboBox();
        jLabel86 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        arrowheadlength = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        featureslotspacing = new javax.swing.JComboBox();
        featurepositions = new javax.swing.JComboBox();
        featureThicknessField = new javax.swing.JTextField();
        minfeaturelength = new javax.swing.JComboBox();
        jLabel45 = new javax.swing.JLabel();
        jLabel46 = new javax.swing.JLabel();
        jLabel47 = new javax.swing.JLabel();
        jLabel48 = new javax.swing.JLabel();
        jLabel49 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jLabel44 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        shorttickthickness = new javax.swing.JComboBox();
        tickDensityField = new javax.swing.JTextField();
        ticklength = new javax.swing.JComboBox();
        tickthickness = new javax.swing.JComboBox();
        jLabel79 = new javax.swing.JLabel();
        jLabel80 = new javax.swing.JLabel();
        jLabel81 = new javax.swing.JLabel();
        jLabel82 = new javax.swing.JLabel();
        jLabel83 = new javax.swing.JLabel();
        jLabel84 = new javax.swing.JLabel();
        jLabel85 = new javax.swing.JLabel();
        shorttickcolor = new javax.swing.JComboBox();
        zerotickcolor = new javax.swing.JComboBox();
        longtickcolor = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        labelson = new javax.swing.JComboBox();
        labellinelength = new javax.swing.JComboBox();
        labelthickness = new javax.swing.JComboBox();
        labelplacement = new javax.swing.JComboBox();
        labelTokeepField = new javax.swing.JTextField();
        moveinnerlabels = new javax.swing.JComboBox();
        labelbackgrounds = new javax.swing.JComboBox();
        useinnerlabels = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel63 = new javax.swing.JLabel();
        jLabel65 = new javax.swing.JLabel();
        jLabel66 = new javax.swing.JLabel();
        jLabel67 = new javax.swing.JLabel();
        jLabel68 = new javax.swing.JLabel();
        jLabel69 = new javax.swing.JLabel();
        jLabel70 = new javax.swing.JLabel();
        jLabel71 = new javax.swing.JLabel();
        globallabelcolour = new javax.swing.JComboBox();
        labelfont = new javax.swing.JComboBox();
        labelfontstyle = new javax.swing.JComboBox();
        jLabel88 = new javax.swing.JLabel();
        labelFontField = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel33 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        jLabel43 = new javax.swing.JLabel();
        showwarnings = new javax.swing.JComboBox();
        jLabel50 = new javax.swing.JLabel();
        jLabel52 = new javax.swing.JLabel();
        warningfontcolor = new javax.swing.JComboBox();
        warningfont = new javax.swing.JComboBox();
        warningFontSizeField = new javax.swing.JTextField();
        jLabel90 = new javax.swing.JLabel();
        warningfontstyle = new javax.swing.JComboBox();
        jLabel51 = new javax.swing.JLabel();
        position = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        backboneRadiusField = new javax.swing.JTextField();
        backbonethickness = new javax.swing.JComboBox();
        rulerpadding = new javax.swing.JTextField();
        rulerunits = new javax.swing.JComboBox();
        jLabel72 = new javax.swing.JLabel();
        jLabel73 = new javax.swing.JLabel();
        jLabel74 = new javax.swing.JLabel();
        jLabel76 = new javax.swing.JLabel();
        jLabel77 = new javax.swing.JLabel();
        jLabel78 = new javax.swing.JLabel();
        backbonecolor = new javax.swing.JComboBox();
        rulerfontcolor = new javax.swing.JComboBox();
        rulerfont = new javax.swing.JComboBox();
        rulerfontstyle = new javax.swing.JComboBox();
        rulerFontSizeField = new javax.swing.JTextField();
        jLabel89 = new javax.swing.JLabel();
        jToggleButton1 = new javax.swing.JToggleButton();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Configure CGVIEW options...");

        jTabbedPane1.setPreferredSize(new java.awt.Dimension(800, 502));

        jLabel7.setText("Background color:");

        jLabel8.setText("Border color:");

        jLabel14.setText("Height: ");

        jLabel15.setText("Is linear?");

        jLabel31.setText("Show border?");

        jLabel32.setText("Show shading?");

        jLabel37.setText("Title font color:");

        jLabel38.setText("Title font:");

        jLabel41.setText("Width:");

        jLabel24.setText("Origin:");

        heightField.setText("3000");

        widthField.setText("3000");

        islinear.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false" }));
        islinear.setSelectedIndex(1);

        showborder.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false" }));

        showshading.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false" }));

        titleFontSizeField.setText("12");

        jLabel53.setText("Sets the color of the circle used to represent the sequence backbone. ");

        jLabel54.setText("Sets the color of the map border. ");

        jLabel55.setText("Sets the height of this map in pixels. ");

        jLabel56.setText("Map includes divider line and labels showing chromosone is linear (map is still circlular). ");

        jLabel57.setText("Sets the width of this map in pixels. ");

        jLabel58.setText("Sets the clock position of the sequence beginning on the circular map backbone. ");

        jLabel59.setText("Specifies whether or not a border should be drawn around the map. ");

        jLabel60.setText("Specifies whether or not map items should be drawn with shading.");

        jLabel61.setText("Sets the color of the text used for the map title. ");

        origin.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
        origin.setSelectedIndex(11);

        backgroundcolor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        backgroundcolor.setSelectedIndex(15);

        bordercolour.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        bordercolour.setSelectedIndex(1);

        titlefontcolour.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        titlefontcolour.setSelectedIndex(1);
        titlefontcolour.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                titlefontcolourActionPerformed(evt);
            }
        });

        titlefont.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "Dialog", "DialogInput", "Monospaced", "Serif", "SansSerif" }));

        titlefontstyle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "plain", "bold", "italic", "bold-italic" }));

        jLabel86.setText("Size:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel38)
                    .addComponent(jLabel37)
                    .addComponent(jLabel14)
                    .addComponent(jLabel41)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8)
                            .addComponent(jLabel31)
                            .addComponent(jLabel32)
                            .addComponent(jLabel24))
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(bordercolour, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(showborder, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(islinear, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(heightField)
                                    .addComponent(widthField, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
                                    .addComponent(titlefontcolour, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(titlefont, 0, 84, Short.MAX_VALUE)
                                    .addComponent(showshading, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(21, 21, 21)
                                        .addComponent(origin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addComponent(titlefontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel86)
                                        .addGap(18, 18, 18)
                                        .addComponent(titleFontSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel59)
                                            .addComponent(jLabel60)
                                            .addComponent(jLabel56, javax.swing.GroupLayout.PREFERRED_SIZE, 577, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel58)
                                            .addComponent(jLabel55)
                                            .addComponent(jLabel57)
                                            .addComponent(jLabel61)))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel54))))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(backgroundcolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel53)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(backgroundcolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel53))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(bordercolour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel54))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(heightField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel55))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel41)
                            .addComponent(widthField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel37)
                            .addComponent(titlefontcolour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel61)))
                    .addComponent(jLabel57))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel38)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(titlefont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(titlefontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel86)
                        .addComponent(titleFontSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel15)
                        .addComponent(islinear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel56))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(showborder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel31))
                        .addGap(8, 8, 8))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel59)
                        .addGap(18, 18, 18)))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(showshading, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel60)
                    .addComponent(jLabel32))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(origin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel58)
                    .addComponent(jLabel24))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Global settings", jPanel1);

        jPanel4.setPreferredSize(new java.awt.Dimension(800, 456));

        jLabel2.setText("Arrowhead length:");

        arrowheadlength.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        arrowheadlength.setSelectedIndex(2);

        jLabel9.setText("FeatureSlot spacing:");

        jLabel10.setText("Feature thickness:");

        jLabel11.setText("Show feature positions?");

        jLabel22.setText("Min. feature length:");

        featureslotspacing.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        featureslotspacing.setSelectedIndex(2);

        featurepositions.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false", "auto" }));
        featurepositions.setSelectedIndex(1);

        featureThicknessField.setText("50");

        minfeaturelength.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        minfeaturelength.setSelectedIndex(2);

        jLabel45.setText("Sets the length of the arrowhead used for features that are drawn as arrows. ");

        jLabel46.setText("Sets the amount of blank space placed between the concentric feature rings. ");

        jLabel47.setText("Sets the maximum thickness of the arcs used when drawing features.");

        jLabel48.setText("Specifies whether start/stop position of features should be added to feature labels. ");

        jLabel49.setText("Very small features are increaed to this length, to ensure that they are visible. ");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel10)
                                    .addComponent(jLabel11)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel9))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(minfeaturelength, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(featurepositions, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(featureslotspacing, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(arrowheadlength, 0, 85, Short.MAX_VALUE)
                                    .addComponent(featureThicknessField, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jLabel22))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel46)
                            .addComponent(jLabel47)
                            .addComponent(jLabel48)
                            .addComponent(jLabel49)
                            .addComponent(jLabel45))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(arrowheadlength, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel48))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGap(9, 9, 9)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(featureslotspacing, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel49))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(featureThicknessField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel47))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(featurepositions, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel46))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(minfeaturelength, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel45))
                .addContainerGap(242, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Feature settings", jPanel4);

        jLabel44.setText("Zero tick color:");

        jLabel34.setText("Tick density:");

        jLabel30.setText("Short tick thickness:");

        jLabel29.setText("Short tick color: ");

        jLabel35.setText("Tick length:");

        jLabel36.setText("Tick thickness:");

        jLabel21.setText("Long tick color: ");

        shorttickthickness.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        shorttickthickness.setSelectedIndex(2);

        tickDensityField.setText("1.0");

        ticklength.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        ticklength.setSelectedIndex(2);

        tickthickness.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        tickthickness.setSelectedIndex(2);

        jLabel79.setText("Sets the color of the tick mark drawn at the boundary between start and end. ");

        jLabel80.setText("Adjusts the density of the tick marks in the sequence ruler. ");

        jLabel81.setText("Sets the length of the tick marks in the sequence ruler. ");

        jLabel82.setText("Sets the thickness of the tick marks in the sequence ruler. ");

        jLabel83.setText("Sets the thickness of the short tick marks in the sequence ruler. ");

        jLabel84.setText("Sets the color of the short tick marks in the sequence ruler. ");

        jLabel85.setText("Sets the color of the long tick marks in the sequence ruler. ");

        shorttickcolor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        shorttickcolor.setSelectedIndex(1);
        shorttickcolor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                shorttickcolorActionPerformed(evt);
            }
        });

        zerotickcolor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        zerotickcolor.setSelectedIndex(1);
        zerotickcolor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                zerotickcolorActionPerformed(evt);
            }
        });

        longtickcolor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        longtickcolor.setSelectedIndex(1);
        longtickcolor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                longtickcolorActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel29)
                    .addComponent(jLabel30)
                    .addComponent(jLabel35)
                    .addComponent(jLabel44)
                    .addComponent(jLabel34)
                    .addComponent(jLabel36)
                    .addComponent(jLabel21))
                .addGap(20, 20, 20)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(longtickcolor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(shorttickcolor, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(shorttickthickness, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tickDensityField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
                    .addComponent(zerotickcolor, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tickthickness, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(ticklength, javax.swing.GroupLayout.Alignment.LEADING, 0, 88, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel83)
                    .addComponent(jLabel84)
                    .addComponent(jLabel80)
                    .addComponent(jLabel79)
                    .addComponent(jLabel81)
                    .addComponent(jLabel82)
                    .addComponent(jLabel85))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(shorttickcolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel84))
                        .addGap(28, 28, 28)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(shorttickthickness, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel30)
                            .addComponent(jLabel83))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tickDensityField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel34)
                            .addComponent(jLabel80))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel44)
                            .addComponent(zerotickcolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel79))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ticklength, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel35)
                            .addComponent(jLabel81))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tickthickness, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel36)
                            .addComponent(jLabel82)))
                    .addComponent(jLabel29))
                .addGap(35, 35, 35)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(jLabel85)
                    .addComponent(longtickcolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(106, 106, 106))
        );

        jTabbedPane1.addTab("Tick settings", jPanel5);

        jLabel12.setText("Labels on?");

        jLabel13.setText("Global label color:");

        jLabel16.setText("Label font:");

        jLabel17.setText("Label line length:");

        jLabel18.setText("Label thickness:");

        jLabel19.setText("Label placement quality:");

        jLabel20.setText("Labels to keep:");

        jLabel23.setText("Move inner labels?");

        jLabel39.setText("Label backgrounds?");

        jLabel40.setText("Use inner labels?");

        labelson.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false", "auto" }));

        labellinelength.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));

        labelthickness.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        labelthickness.setSelectedIndex(2);

        labelplacement.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "good", "better", "best" }));
        labelplacement.setSelectedIndex(1);

        labelTokeepField.setText("1000");

        moveinnerlabels.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false" }));

        labelbackgrounds.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false", "auto" }));
        labelbackgrounds.setSelectedIndex(1);

        useinnerlabels.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false", "auto" }));

        jLabel1.setText("Specifies whether or not feature labels should be drawn on this map. ");

        jLabel63.setText("Labels are colored according to the globalLabelColor value. ");

        jLabel65.setText("Sets  initial length of line drawn between features and labels.");

        jLabel66.setText("The thickness of the line that is drawn to connect features to their labels. ");

        jLabel67.setText("Alters the placement of feature labels.");

        jLabel68.setText("Labels are randomly discarded if there are more labels than this value.");

        jLabel69.setText("Should inner labels be moved to outside of circle if there is insufficient room? ");

        jLabel70.setText("Specifies whether a colored rectangle should be drawn around each label. ");

        jLabel71.setText("Specifies whether feature labels should be drawn on the inside of circle.");

        globallabelcolour.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        globallabelcolour.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                globallabelcolourActionPerformed(evt);
            }
        });

        labelfont.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "Dialog", "DialogInput", "Monospaced", "Serif", "SansSerif" }));

        labelfontstyle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "plain", "bold", "italic", "bold-italic" }));

        jLabel88.setText("Size:");

        labelFontField.setText("12");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel19)
                                    .addComponent(jLabel20)
                                    .addComponent(jLabel18)
                                    .addComponent(jLabel23)
                                    .addComponent(jLabel39)
                                    .addComponent(jLabel40)
                                    .addComponent(jLabel16)
                                    .addComponent(jLabel12))
                                .addGap(36, 36, 36)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(useinnerlabels, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(moveinnerlabels, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(labelTokeepField)
                                        .addComponent(labelplacement, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(labelbackgrounds, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(labelthickness, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addComponent(labelson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(globallabelcolour, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(labelfont, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                                        .addComponent(labellinelength, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                            .addComponent(jLabel13))
                        .addGap(22, 22, 22)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel67)
                            .addComponent(jLabel68)
                            .addComponent(jLabel69)
                            .addComponent(jLabel70)
                            .addComponent(jLabel71)
                            .addComponent(jLabel1)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(labelfontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(13, 13, 13)
                                .addComponent(jLabel88)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(labelFontField, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel63)
                            .addComponent(jLabel65)
                            .addComponent(jLabel66)))
                    .addComponent(jLabel17))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel13)
                        .addComponent(globallabelcolour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel63))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(labelfont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelfontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel88)
                    .addComponent(labelFontField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(labellinelength, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel65))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(labelthickness, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel66))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(labelplacement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel67))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(labelTokeepField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel68))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(moveinnerlabels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel69))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel39)
                    .addComponent(labelbackgrounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel70))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel40)
                    .addComponent(useinnerlabels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel71))
                .addGap(19, 19, 19))
        );

        jTabbedPane1.addTab("Label settings", jPanel2);

        jLabel33.setText("Show warnings:");

        jLabel42.setText("Legend/Warning font:");

        jLabel43.setText("Legend/Warning font color:");

        showwarnings.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "true", "false" }));
        showwarnings.setSelectedIndex(1);

        jLabel50.setText("Should CGView should add warning messages to the lower left of map?");

        jLabel52.setText("Text color used for legends & warnings. ");

        warningfontcolor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        warningfontcolor.setSelectedIndex(1);
        warningfontcolor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                warningfontcolorActionPerformed(evt);
            }
        });

        warningfont.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "Dialog", "DialogInput", "Monospaced", "Serif", "SansSerif" }));

        warningFontSizeField.setText("12");

        jLabel90.setText("Size:");

        warningfontstyle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "plain", "bold", "italic", "bold-italic" }));
        warningfontstyle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                warningfontstyleActionPerformed(evt);
            }
        });

        jLabel51.setText("Legend position");

        position.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "upper-right", "upper-left", "upper-center", "middle-left", "middle-center", "middle-right", "lower-left", "lower-center", "lower-right" }));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel33)
                                    .addComponent(jLabel42))
                                .addGap(37, 37, 37)
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(warningfont, 0, 169, Short.MAX_VALUE)
                                    .addComponent(showwarnings, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(jLabel43)
                                .addGap(24, 24, 24)
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(position, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(warningfontcolor, 0, 141, Short.MAX_VALUE))))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(warningfontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel90)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(warningFontSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel50)
                            .addComponent(jLabel52))
                        .addGap(552, 552, 552))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel51)
                        .addContainerGap(711, Short.MAX_VALUE))))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel33)
                    .addComponent(showwarnings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel50))
                .addGap(34, 34, 34)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel42)
                    .addComponent(warningfont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(warningfontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel90)
                    .addComponent(warningFontSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel43)
                    .addComponent(warningfontcolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel52))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel51)
                    .addComponent(position, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(247, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Legend & Warning font settings", jPanel6);

        jPanel3.setAutoscrolls(true);

        jLabel4.setText("Backbone color:");

        jLabel5.setText("Backbone radius:");

        jLabel6.setText("Backbone thickness:");

        jLabel25.setText("Ruler font: ");

        jLabel26.setText("Ruler font color:");

        jLabel27.setText("Ruler padding: ");

        jLabel28.setText("Ruler units:");

        backboneRadiusField.setText("400");
        backboneRadiusField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backboneRadiusFieldActionPerformed(evt);
            }
        });

        backbonethickness.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large" }));
        backbonethickness.setSelectedIndex(2);

        rulerpadding.setText("10");

        rulerunits.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "bases", "centisomes" }));

        jLabel72.setText("Sets the color of the circle used to represent the sequence backbone. ");

        jLabel73.setText("Sets the radius of the circle (in pixels) used to represent the sequence backbone.");

        jLabel74.setText("Sets line thickness  used to draw the circle that representing sequence backbone. ");

        jLabel76.setText("Sets the color of the text used for the sequence ruler. ");

        jLabel77.setText("Sets the spacing between the inner tickmarks and the sequence ruler labels.");

        jLabel78.setText("Sets the units used for the sequence ruler. ");

        backbonecolor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        backbonecolor.setSelectedIndex(1);
        backbonecolor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backbonecolorActionPerformed(evt);
            }
        });

        rulerfontcolor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow" }));
        rulerfontcolor.setSelectedIndex(1);
        rulerfontcolor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rulerfontcolorActionPerformed(evt);
            }
        });

        rulerfont.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "Dialog", "DialogInput", "Monospaced", "Serif", "SansSerif" }));

        rulerfontstyle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "plain", "bold", "italic", "bold-italic" }));

        rulerFontSizeField.setText("12");

        jLabel89.setText("Size:");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel25)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                                .addComponent(rulerfont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel4)
                            .addComponent(jLabel5)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addGap(3, 3, 3)
                                .addComponent(backbonethickness, 0, 115, Short.MAX_VALUE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(159, 159, 159)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(backboneRadiusField, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(backbonecolor, javax.swing.GroupLayout.Alignment.LEADING, 0, 88, Short.MAX_VALUE))
                                .addGap(0, 0, 0)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel73)
                            .addComponent(jLabel74)
                            .addComponent(jLabel72)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(rulerfontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel89)
                                .addGap(9, 9, 9)
                                .addComponent(rulerFontSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(576, 576, 576))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel27)
                                .addGap(18, 18, 18)
                                .addComponent(rulerpadding))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel26)
                                .addGap(10, 10, 10)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(rulerunits, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(rulerfontcolor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addComponent(jLabel28))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel76)
                            .addComponent(jLabel77)
                            .addComponent(jLabel78))
                        .addContainerGap(76, Short.MAX_VALUE))))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(backbonecolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel72))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(backboneRadiusField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel73, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jLabel74)
                    .addComponent(backbonethickness, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(rulerfont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rulerfontstyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rulerFontSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel89))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(rulerfontcolor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel76))
                .addGap(37, 37, 37)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rulerpadding, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel77))
                .addGap(28, 28, 28)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel28)
                    .addComponent(rulerunits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel78))
                .addGap(102, 102, 102))
        );

        jTabbedPane1.addTab("Backbone and ruler settings", jPanel3);

        jToggleButton1.setText("Save & close");
        jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton1ActionPerformed(evt);
            }
        });

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

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(711, 711, 711)
                        .addComponent(jToggleButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton1))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 853, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jToggleButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 502, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
    save();
    }//GEN-LAST:event_jToggleButton1ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        dispose();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void warningfontstyleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_warningfontstyleActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_warningfontstyleActionPerformed

    private void warningfontcolorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_warningfontcolorActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_warningfontcolorActionPerformed

    private void globallabelcolourActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_globallabelcolourActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_globallabelcolourActionPerformed

    private void rulerfontcolorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rulerfontcolorActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_rulerfontcolorActionPerformed

    private void backbonecolorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backbonecolorActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_backbonecolorActionPerformed

    private void backboneRadiusFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backboneRadiusFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_backboneRadiusFieldActionPerformed

    private void longtickcolorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_longtickcolorActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_longtickcolorActionPerformed

    private void zerotickcolorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zerotickcolorActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_zerotickcolorActionPerformed

    private void shorttickcolorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shorttickcolorActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_shorttickcolorActionPerformed

    private void titlefontcolourActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_titlefontcolourActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_titlefontcolourActionPerformed


    private  void save(){
        int error =0;
        String errorText = "";
        if(!isInt( heightField.getText() ) ){
            error++;
            errorText = "Height is not a valid integer\n";
        }
        if(!isInt( widthField.getText() ) ){
            error++;
            errorText = "Width is not a valid integer\n";
        }
        if(!isDouble( featureThicknessField.getText() ) ){
            error++;
            errorText = "Feature thickness is not a valid number\n";
        }
        try{
            Double a = Double.parseDouble(tickDensityField.getText());
            if(a < 0.0 || a > 1.0){
                error++;
                errorText = "Tick density is not between 0.0 and 1.0\n";
            }
        }catch(NumberFormatException e){
            error++;
            errorText = "Tick density is not a valid number\n";
        }
        if(!isInt( backboneRadiusField.getText() ) ){
            error++;
            errorText = "Backbone radius is not a valid integer\n";
        }
        if(!isInt( rulerpadding.getText() ) ){
            error++;
            errorText = "Ruler padding is not a valid integer\n";
        }
        if(!isInt( rulerFontSizeField.getText() ) ){
            error++;
            errorText = "Ruler font size is not a valid integer\n";
        }
        if(!isInt( labelFontField.getText() ) ){
            error++;
            errorText = "Label font size is not a valid integer\n";
        }
        if(!isInt( labelTokeepField.getText() ) ){
            error++;
            errorText = "Label to keep value is not a valid integer\n";
        }
        if(!isInt( warningFontSizeField.getText() ) ){
            error++;
            errorText = "Warning font size is not a valid integer\n";
        }
        if(error > 0){
         errorText = "There are " + error + " errror(s):\n" +errorText;
            JOptionPane.showMessageDialog(this,
            errorText,
            "ERROR!",
         JOptionPane.ERROR_MESSAGE);
        }else{
            try{
                Element root = BRIG.PROFILE.getRootElement().getChild("cgview_settings");
                root.setAttribute("featureThickness",featureThicknessField.getText() );
                root.setAttribute("arrowheadLength", arrowheadlength.getSelectedItem().toString() );
                root.setAttribute("backboneColor", backbonecolor.getSelectedItem().toString() );
                root.setAttribute("backboneRadius", backboneRadiusField.getText() );
                root.setAttribute("backboneThickness", backbonethickness.getSelectedItem().toString() );
                root.setAttribute("backgroundColor", backgroundcolor.getSelectedItem().toString() );
                root.setAttribute("borderColor", bordercolour.getSelectedItem().toString() );
                root.setAttribute("featureSlotSpacing", featureslotspacing.getSelectedItem().toString() );
                root.setAttribute("featureThickness", featureThicknessField.getText() );
                root.setAttribute("giveFeaturePositions", featurepositions.getSelectedItem().toString() );
                root.setAttribute("globalLabel", labelson.getSelectedItem().toString() );
                if(globallabelcolour.getSelectedIndex() !=0 ){
                    root.setAttribute("globalLabelColor", globallabelcolour.getSelectedItem().toString() );
                }
                root.setAttribute("height", heightField.getText() );
                root.setAttribute("isLinear", islinear.getSelectedItem().toString() );
                root.setAttribute("labelFont", labelfont.getSelectedItem()+"," +
                        labelfontstyle.getSelectedItem() + "," + labelFontField.getText());
                root.setAttribute("labelLineLength", labellinelength.getSelectedItem().toString() );
                root.setAttribute("labelLineThickness", labelthickness.getSelectedItem().toString() );
                root.setAttribute("labelPlacementQuality", labelplacement.getSelectedItem().toString() );
                root.setAttribute("labelsToKeep", labelTokeepField.getText() );
                root.setAttribute("longTickColor", longtickcolor.getSelectedItem().toString() );
                root.setAttribute("minimumFeatureLength", minfeaturelength.getSelectedItem().toString() );
                root.setAttribute("moveInnerLabelsToOuter", moveinnerlabels.getSelectedItem().toString() );
                root.setAttribute("origin", origin.getSelectedItem().toString() );
                root.setAttribute("rulerFont", rulerfont.getSelectedItem()+"," +
                        rulerfontstyle.getSelectedItem() + "," + rulerFontSizeField.getText() );
                root.setAttribute("rulerFontColor", rulerfontcolor.getSelectedItem().toString() );
                root.setAttribute("rulerPadding", rulerpadding.getText() );
                root.setAttribute("rulerUnits", rulerunits.getSelectedItem().toString() );
                root.setAttribute("shortTickColor", shorttickcolor.getSelectedItem().toString() );
                root.setAttribute("shortTickThickness", shorttickthickness.getSelectedItem().toString() );
                root.setAttribute("showBorder", showborder.getSelectedItem().toString() );
                root.setAttribute("showShading", showshading.getSelectedItem().toString() );
                root.setAttribute("showWarning", showwarnings.getSelectedItem().toString() );
                root.setAttribute("tickDensity", tickDensityField.getText() );
                root.setAttribute("tickLength", ticklength.getSelectedItem().toString() );
                root.setAttribute("tickThickness", tickthickness.getSelectedItem().toString() );
                root.setAttribute("titleFont", titlefont.getSelectedItem()+"," +
                        titlefontstyle.getSelectedItem() + "," + titleFontSizeField.getText());
                root.setAttribute("titleFontColor", titlefontcolour.getSelectedItem().toString() );
                root.setAttribute("useColoredLabelBackgrounds", labelbackgrounds.getSelectedItem().toString() );
                root.setAttribute("useInnerLabels", useinnerlabels.getSelectedItem().toString() );
                root.setAttribute("warningFont", warningfont.getSelectedItem()+"," +
                        warningfontstyle.getSelectedItem() + "," + warningFontSizeField.getText());
                root.setAttribute("warningFontColor", warningfontcolor.getSelectedItem().toString() );
                root.setAttribute("width", widthField.getText() );
                root.setAttribute("zeroTickColor", zerotickcolor.getSelectedItem().toString() );
                BRIG.PROFILE.getRootElement().setAttribute("legendPosition",position.getSelectedItem().toString());
                this.dispose();
            }catch(Exception e){
                JOptionPane.showMessageDialog(this,
                    "Could not save settings",
                    "ERROR!",
                    JOptionPane.ERROR_MESSAGE);
            }

        }
    }
    private void load() {
        
        Element settings = BRIG.PROFILE.getRootElement().getChild("cgview_settings");
        if (settings.getAttributeValue("backboneColor") != null) {
            backbonecolor.setSelectedItem(settings.getAttributeValue("backboneColor"));
        }
        if (BRIG.PROFILE.getRootElement().getAttributeValue("legendPosition") != null) {
            position.setSelectedItem(BRIG.PROFILE.getRootElement().getAttributeValue("legendPosition"));
        }
        if (settings.getAttributeValue("backboneRadius")!= null) {
            backboneRadiusField.setText(settings.getAttributeValue("backboneRadius"));
        }
        if (settings.getAttributeValue("backboneThickness")!= null) {
            backbonethickness.setSelectedItem(settings.getAttributeValue("backboneThickness"));
        }
        if (settings.getAttributeValue("backgroundColor")!= null) {
            backgroundcolor.setSelectedItem(settings.getAttributeValue("backgroundColor"));
        }
        if (settings.getAttributeValue("borderColor")!= null) {
            bordercolour.setSelectedItem(settings.getAttributeValue("borderColor"));
        }
        if (settings.getAttributeValue("featureSlotSpacing")!= null) {
            featureslotspacing.setSelectedItem(settings.getAttributeValue("featureSlotSpacing"));
        }
        if (settings.getAttributeValue("featureThickness")!= null) {
            featureThicknessField.setText(settings.getAttributeValue("featureThickness"));
        }
        if (settings.getAttributeValue("giveFeaturePositions")!= null) {
            featurepositions.setSelectedItem(settings.getAttributeValue("giveFeaturePositions")) ;
        }
        if (settings.getAttributeValue("globalLabel")!= null) {
            labelson.setSelectedItem(settings.getAttributeValue("globalLabel"));
        }
        if (settings.getAttributeValue("globalLabelColor")!= null) {
            globallabelcolour.setSelectedItem(settings.getAttributeValue("globalLabelColor"));
        }
        if (settings.getAttributeValue("height")!= null) {
            heightField.setText(settings.getAttributeValue("height"));
        }
        if (settings.getAttributeValue("isLinear")!= null) {
            islinear.setSelectedItem(settings.getAttributeValue("isLinear"));
        }
        if (settings.getAttributeValue("labelFont")!= null) {
            String[] spootArray = settings.getAttributeValue("labelFont").split(",");
            labelfont.setSelectedItem(spootArray[0]);
            labelfontstyle.setSelectedItem(spootArray[1]);
            labelFontField.setText(spootArray[2]);
        }
        if (settings.getAttributeValue("labelLineLength")!= null) {
            labellinelength.setSelectedItem(settings.getAttributeValue("labelLineLength"));
        }
        if (settings.getAttributeValue("labelLineThickness")!= null) {
            labelthickness.setSelectedItem(settings.getAttributeValue("labelLineThickness"));
        }
        if (settings.getAttributeValue("labelPlacementQuality")!= null) {
            labelplacement.setSelectedItem(settings.getAttributeValue("labelPlacementQuality"));
        }
        if (settings.getAttributeValue("labelsToKeep")!= null) {
            labelTokeepField.setText(settings.getAttributeValue("labelsToKeep"));
        }
        if (settings.getAttributeValue("longTickColor")!= null) {
            longtickcolor.setSelectedItem(settings.getAttributeValue("longTickColor"));
        }
        if (settings.getAttributeValue("minimumFeatureLength")!= null) {
            minfeaturelength.setSelectedItem(settings.getAttributeValue("minimumFeatureLength"));
        }
        if (settings.getAttributeValue("moveInnerLabelsToOuter")!= null) {
            moveinnerlabels.setSelectedItem(settings.getAttributeValue("moveInnerLabelsToOuter"));
        }
        if (settings.getAttributeValue("origin")!= null) {
            origin.setSelectedItem(settings.getAttributeValue("origin"));
        }
        if (settings.getAttributeValue("rulerFont")!= null) {
            String[] spootArray = settings.getAttributeValue("rulerFont").split(",");
            rulerfont.setSelectedItem(spootArray[0]);
            rulerfontstyle.setSelectedItem(spootArray[1]);
            rulerFontSizeField.setText(spootArray[2]);
        }
        if (settings.getAttributeValue("rulerFontColor")!= null) {
            rulerfontcolor.setSelectedItem(settings.getAttributeValue("rulerFontColor"));
        }
        if (settings.getAttributeValue("rulerPadding")!= null) {
            rulerpadding.setText(settings.getAttributeValue("rulerPadding"));
        }
        if (settings.getAttributeValue("rulerUnits")!= null) {
            rulerunits.setSelectedItem(settings.getAttributeValue("rulerUnits"));
        }
        if (settings.getAttributeValue("shortTickColor")!= null) {
            shorttickcolor.setSelectedItem(settings.getAttributeValue("shortTickColor"));
        }
        if (settings.getAttributeValue("shortTickThickness")!= null) {
            shorttickthickness.setSelectedItem(settings.getAttributeValue("shortTickThickness"));
        }
        if (settings.getAttributeValue("showBorder")!= null) {
            showborder.setSelectedItem(settings.getAttributeValue("showBorder"));
        }
        if (settings.getAttributeValue("showShading")!= null) {
            showshading.setSelectedItem(settings.getAttributeValue("showShading"));
        }
        if (settings.getAttributeValue("showWarning")!= null) {
            showwarnings.setSelectedItem(settings.getAttributeValue("showWarning"));
        }
        if (settings.getAttributeValue("tickDensity")!= null) {
            tickDensityField.setText(settings.getAttributeValue("tickDensity"));
        }
        if (settings.getAttributeValue("tickThickness")!= null) {
            tickthickness.setSelectedItem(settings.getAttributeValue("tickThickness"));
        }
        if (settings.getAttributeValue("tickLength")!= null) {
            ticklength.setSelectedItem(settings.getAttributeValue("tickLength"));
        }
        if (settings.getAttributeValue("titleFont")!= null) {
            String[] spootArray = settings.getAttributeValue("titleFont").split(",");
            titlefont.setSelectedItem(spootArray[0]);
            titlefontstyle.setSelectedItem(spootArray[1]);
            titleFontSizeField.setText(spootArray[2]);
        }
        if (settings.getAttributeValue("titleFontColor")!= null) {
            titlefontcolour.setSelectedItem(settings.getAttributeValue("titleFontColor"));
        }
        if (settings.getAttributeValue("useColoredLabelBackgrounds")!= null) {
            labelbackgrounds.setSelectedItem(settings.getAttributeValue("useColoredLabelBackgrounds"));
        }
        if (settings.getAttributeValue("useInnerLabels")!= null) {
            useinnerlabels.setSelectedItem(settings.getAttributeValue("useInnerLabels"));
        }
        if (settings.getAttributeValue("warningFont")!= null) {
            String[] spootArray = settings.getAttributeValue("warningFont").split(",");
            warningfont.setSelectedItem(spootArray[0]);
            warningfontstyle.setSelectedItem(spootArray[1]);
            warningFontSizeField.setText(spootArray[2]);
        }
        if (settings.getAttributeValue("warningFontColor")!= null) {
            warningfontcolor.setSelectedItem(settings.getAttributeValue("warningFontColor"));
        }
        if (settings.getAttributeValue("width")!= null) {
            widthField.setText(settings.getAttributeValue("width"));
        }
        if (settings.getAttributeValue("zeroTickColor")!= null) {
            zerotickcolor.setSelectedItem(settings.getAttributeValue("zeroTickColor"));
        }

    }


    private boolean isInt(String in){
    try{
        Integer.parseInt(in);
        return true;
        }catch(NumberFormatException e){
            return false;
        }
    }
    private boolean isDouble(String in){
    try{
        Double.parseDouble(in);
        return true;
        }catch(NumberFormatException e){
            return false;
        }
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CGHeader().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox arrowheadlength;
    private javax.swing.JTextField backboneRadiusField;
    private javax.swing.JComboBox backbonecolor;
    private javax.swing.JComboBox backbonethickness;
    private javax.swing.JComboBox backgroundcolor;
    private javax.swing.JComboBox bordercolour;
    private javax.swing.JTextField featureThicknessField;
    private javax.swing.JComboBox featurepositions;
    private javax.swing.JComboBox featureslotspacing;
    private javax.swing.JComboBox globallabelcolour;
    private javax.swing.JTextField heightField;
    private javax.swing.JComboBox islinear;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel49;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel52;
    private javax.swing.JLabel jLabel53;
    private javax.swing.JLabel jLabel54;
    private javax.swing.JLabel jLabel55;
    private javax.swing.JLabel jLabel56;
    private javax.swing.JLabel jLabel57;
    private javax.swing.JLabel jLabel58;
    private javax.swing.JLabel jLabel59;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel60;
    private javax.swing.JLabel jLabel61;
    private javax.swing.JLabel jLabel63;
    private javax.swing.JLabel jLabel65;
    private javax.swing.JLabel jLabel66;
    private javax.swing.JLabel jLabel67;
    private javax.swing.JLabel jLabel68;
    private javax.swing.JLabel jLabel69;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel70;
    private javax.swing.JLabel jLabel71;
    private javax.swing.JLabel jLabel72;
    private javax.swing.JLabel jLabel73;
    private javax.swing.JLabel jLabel74;
    private javax.swing.JLabel jLabel76;
    private javax.swing.JLabel jLabel77;
    private javax.swing.JLabel jLabel78;
    private javax.swing.JLabel jLabel79;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel80;
    private javax.swing.JLabel jLabel81;
    private javax.swing.JLabel jLabel82;
    private javax.swing.JLabel jLabel83;
    private javax.swing.JLabel jLabel84;
    private javax.swing.JLabel jLabel85;
    private javax.swing.JLabel jLabel86;
    private javax.swing.JLabel jLabel88;
    private javax.swing.JLabel jLabel89;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabel90;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JToggleButton jToggleButton1;
    private javax.swing.JTextField labelFontField;
    private javax.swing.JTextField labelTokeepField;
    private javax.swing.JComboBox labelbackgrounds;
    private javax.swing.JComboBox labelfont;
    private javax.swing.JComboBox labelfontstyle;
    private javax.swing.JComboBox labellinelength;
    private javax.swing.JComboBox labelplacement;
    private javax.swing.JComboBox labelson;
    private javax.swing.JComboBox labelthickness;
    private javax.swing.JComboBox longtickcolor;
    private javax.swing.JComboBox minfeaturelength;
    private javax.swing.JComboBox moveinnerlabels;
    private javax.swing.JComboBox origin;
    private javax.swing.JComboBox position;
    private javax.swing.JTextField rulerFontSizeField;
    private javax.swing.JComboBox rulerfont;
    private javax.swing.JComboBox rulerfontcolor;
    private javax.swing.JComboBox rulerfontstyle;
    private javax.swing.JTextField rulerpadding;
    private javax.swing.JComboBox rulerunits;
    private javax.swing.JComboBox shorttickcolor;
    private javax.swing.JComboBox shorttickthickness;
    private javax.swing.JComboBox showborder;
    private javax.swing.JComboBox showshading;
    private javax.swing.JComboBox showwarnings;
    private javax.swing.JTextField tickDensityField;
    private javax.swing.JComboBox ticklength;
    private javax.swing.JComboBox tickthickness;
    private javax.swing.JTextField titleFontSizeField;
    private javax.swing.JComboBox titlefont;
    private javax.swing.JComboBox titlefontcolour;
    private javax.swing.JComboBox titlefontstyle;
    private javax.swing.JComboBox useinnerlabels;
    private javax.swing.JTextField warningFontSizeField;
    private javax.swing.JComboBox warningfont;
    private javax.swing.JComboBox warningfontcolor;
    private javax.swing.JComboBox warningfontstyle;
    private javax.swing.JTextField widthField;
    private javax.swing.JComboBox zerotickcolor;
    // End of variables declaration//GEN-END:variables

}
