addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); } });
initFileChooser();
    private void jbInit() throws Exception {        setTitle("Particle System Editor");        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);        initColorChooser();        addWindowListener(new WindowAdapter() {            public void windowClosing(WindowEvent e) {                dispose();            }        });        getContentPane().setLayout(new GridBagLayout());        colorBorder = new TitledBorder(" PARTICLE COLOR ");        sizeBorder = new TitledBorder(" PARTICLE SIZE ");        ageBorder = new TitledBorder(" PARTICLE AGE ");        speedBorder = new TitledBorder(" PARTICLE SPEED ");        textureBorder = new TitledBorder(" PARTICLE TEXTURE ");        gravityBorder = new TitledBorder(" GRAVITY ");        emitBorder = new TitledBorder(" EMISSION DIRECTION ");        angleBorder = new TitledBorder(" ANGLE ");        randomBorder = new TitledBorder(" SYSTEM RANDOMNESS ");        countBorder = new TitledBorder(" PARTICLE COUNT ");        rateBorder = new TitledBorder(" RATE ");        spawnBorder = new TitledBorder(" SPAWN s");        velocityBorder = new TitledBorder(" VELOCITY ");        spinBorder = new TitledBorder(" PARTICLE SPIN ");        appPanel.setLayout(new GridBagLayout());        emitPanel.setLayout(new GridBagLayout());        worldPanel.setLayout(new GridBagLayout());        colorPanel.setLayout(new GridBagLayout());        startColorLabel.setFont(new java.awt.Font("Arial", 1, 13));        startColorLabel.setRequestFocusEnabled(true);        startColorLabel.setText("Starting Color:");        colorLabel.setFont(new java.awt.Font("Arial", 1, 14));        colorLabel.setText(">>");        endColorLabel.setFont(new java.awt.Font("Arial", 1, 13));        endColorLabel.setText("End Color:");        startColorHex.setFont(new java.awt.Font("Arial", 0, 10));        startColorHex.setText("#FFFFFF");        endColorHex.setFont(new java.awt.Font("Arial", 0, 10));        endColorHex.setText("#FFFFFF");        startColorPanel.setBackground(Color.white);        startColorPanel.setBorder(BorderFactory.createRaisedBevelBorder());        startColorPanel.addMouseListener(new java.awt.event.MouseAdapter() {            public void mouseClicked(MouseEvent e) {                startColorPanel_mouseClicked(e);            }        });        endColorPanel.setBackground(Color.white);        endColorPanel.setBorder(BorderFactory.createRaisedBevelBorder());        endColorPanel.addMouseListener(new java.awt.event.MouseAdapter() {            public void mouseClicked(MouseEvent e) {                endColorPanel_mouseClicked(e);            }        });        colorPanel.setBorder(colorBorder);        colorPanel.setOpaque(false);        colorBorder.setTitleColor(Color.black);        colorBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        colorBorder.setBorder(BorderFactory.createEtchedBorder());        startAlphaLabel.setFont(new java.awt.Font("Arial", 0, 11));        startAlphaLabel.setText("alpha:");        endAlphaLabel.setFont(new java.awt.Font("Arial", 0, 11));        endAlphaLabel.setText("alpha:");        startSizeLabel.setFont(new java.awt.Font("Arial", 1, 13));        startSizeLabel.setText("Start Size:  0.0");        sizePanel.setLayout(new GridBagLayout());        sizePanel.setBorder(sizeBorder);        sizePanel.setOpaque(false);        sizeBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        endSizeLabel.setFont(new java.awt.Font("Arial", 1, 13));        endSizeLabel.setText("End Size: 0.0");        endSizeSlider.setMaximum(400);        endSizeSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = endSizeSlider.getValue();                particleMesh.setEndSize(val / 10f);                updateSizeLabels();                regenCode();            }        });        startSizeSlider.setMaximum(400);        startSizeSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = startSizeSlider.getValue();                particleMesh.setStartSize(val / 10f);                updateSizeLabels();                regenCode();            }        });        ageBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        ageBorder.setBorder(BorderFactory.createEtchedBorder());        speedPanel.setLayout(new GridBagLayout());        speedPanel.setBorder(speedBorder);        speedPanel.setOpaque(false);        speedLabel.setFont(new java.awt.Font("Arial", 1, 13));        speedLabel.setText("Speed Mod.: 0%");        speedBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        speedSlider.setMaximum(100);        speedSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = speedSlider.getValue();                particleMesh.getParticleController().setSpeed((float) val * .1f);                updateSpeedLabels();                regenCode();            }        });        texturePanel.setBorder(textureBorder);        texturePanel.setLayout(new GridBagLayout());        textureBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        textureLabel.setFont(new java.awt.Font("Arial", 1, 13));        textureLabel.setText("Texture Image:");        changeTextureButton.setFont(new java.awt.Font("Arial", 1, 12));        changeTextureButton.setMargin(new Insets(2, 2, 2, 2));        changeTextureButton.setText("Browse...");        changeTextureButton                .addActionListener(new java.awt.event.ActionListener() {                    public void actionPerformed(ActionEvent e) {                        changeTexture();                    }                });        imageLabel.setBackground(Color.lightGray);        imageLabel.setMaximumSize(new Dimension(128, 128));        imageLabel.setMinimumSize(new Dimension(0, 0));        imageLabel.setOpaque(false);        imageLabel.setText("");        ImageIcon icon = new ImageIcon(RenParticleEditor.class.getClassLoader()                .getResource("jmetest/data/texture/flaresmall.jpg"));        imageLabel.setIcon(icon);        gravityPanel.setBorder(gravityBorder);        gravityPanel.setLayout(new GridBagLayout());        gravityBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        gravXLabel.setText("X");        gravXSlider.setOrientation(JSlider.VERTICAL);        gravXSlider.setInverted(false);        gravXSlider.setMajorTickSpacing(16);        gravXSlider.setMaximum(32);        gravXSlider.setMinimum(-32);        gravXSlider.setMinorTickSpacing(4);        gravXSlider.setPaintLabels(true);        gravXSlider.setPaintTicks(true);        gravXSlider.setPaintTrack(true);        gravXSlider.setValue(0);        gravXSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = gravXSlider.getValue();                if (particleMesh != null)                    particleMesh.getGravityForce().x = (float) val * 0.001f;                regenCode();            }        });        gravYLabel.setText("Y");        gravYSlider.setOrientation(JSlider.VERTICAL);        gravYSlider.setInverted(false);        gravYSlider.setMajorTickSpacing(16);        gravYSlider.setMaximum(32);        gravYSlider.setMinimum(-32);        gravYSlider.setMinorTickSpacing(4);        gravYSlider.setPaintLabels(true);        gravYSlider.setPaintTicks(true);        gravYSlider.setPaintTrack(true);        gravYSlider.setValue(0);        gravYSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = gravYSlider.getValue();                if (particleMesh != null)                    particleMesh.getGravityForce().y = (float) val * 0.001f;                regenCode();            }        });        gravZLabel.setText("Z");        gravZSlider.setOrientation(JSlider.VERTICAL);        gravZSlider.setInverted(false);        gravZSlider.setMajorTickSpacing(16);        gravZSlider.setMaximum(32);        gravZSlider.setMinimum(-32);        gravZSlider.setMinorTickSpacing(4);        gravZSlider.setPaintLabels(true);        gravZSlider.setPaintTicks(true);        gravZSlider.setPaintTrack(true);        gravZSlider.setValue(0);        gravZSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = gravZSlider.getValue();                if (particleMesh != null)                    particleMesh.getGravityForce().z = (float) val * 0.001f;                regenCode();            }        });        agePanel.setLayout(new GridBagLayout());        agePanel.setBorder(ageBorder);        minAgeLabel.setFont(new java.awt.Font("Arial", 1, 13));        minAgeLabel.setText("Minimum Age: 1000ms");        minAgeSlider.setMajorTickSpacing(1000);        minAgeSlider.setMaximum(10000);        minAgeSlider.setMinimum(0);        minAgeSlider.setMinorTickSpacing(100);        minAgeSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = minAgeSlider.getValue();                particleMesh.setMinimumLifeTime((float)val);                updateAgeLabels();                regenCode();            }        });        maxAgeLabel.setFont(new java.awt.Font("Arial", 1, 13));        maxAgeLabel.setText("Maximum Age: 1000ms");        maxAgeSlider.setMajorTickSpacing(1000);        maxAgeSlider.setMaximum(10000);        maxAgeSlider.setMinimum(0);        maxAgeSlider.setMinorTickSpacing(100);        maxAgeSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = maxAgeSlider.getValue();                particleMesh.setMaximumLifeTime((float)val);                updateAgeLabels();                regenCode();            }        });        directionPanel.setBorder(emitBorder);        directionPanel.setLayout(new GridBagLayout());        emitBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        emitBorder.setTitle(" DIRECTION ");        emitZSlider.setOrientation(JSlider.VERTICAL);        emitZSlider.setMajorTickSpacing(5);        emitZSlider.setMinimum(-10);        emitZSlider.setMaximum(10);        emitZSlider.setMinorTickSpacing(1);        emitZSlider.setPaintLabels(true);        emitZSlider.setPaintTicks(true);        emitZSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = emitZSlider.getValue();                if (particleMesh != null) {                    particleMesh.getEmissionDirection().z = (float) val * .1f;                    particleMesh.updateRotationMatrix();                }                regenCode();            }        });        emitYSlider.setOrientation(JSlider.VERTICAL);        emitYSlider.setMajorTickSpacing(5);        emitYSlider.setMinimum(-10);        emitYSlider.setMaximum(10);        emitYSlider.setMinorTickSpacing(1);        emitYSlider.setPaintLabels(true);        emitYSlider.setPaintTicks(true);        emitYSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = emitYSlider.getValue();                if (particleMesh != null) {                    particleMesh.getEmissionDirection().y = (float) val * .1f;                    particleMesh.updateRotationMatrix();                }                regenCode();            }        });        emitXSlider.setOrientation(JSlider.VERTICAL);        emitXSlider.setMajorTickSpacing(5);        emitXSlider.setMinimum(-10);        emitXSlider.setMaximum(10);        emitXSlider.setMinorTickSpacing(1);        emitXSlider.setPaintLabels(true);        emitXSlider.setPaintTicks(true);        emitXSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = emitXSlider.getValue();                if (particleMesh != null) {                    particleMesh.getEmissionDirection().x = (float) val * .1f;                    particleMesh.updateRotationMatrix();                }                regenCode();            }        });        emitXLabel.setFont(new java.awt.Font("Arial", 1, 13));        emitXLabel.setText("X");        emitYLabel.setFont(new java.awt.Font("Arial", 1, 13));        emitYLabel.setText("Y");        emitZLabel.setFont(new java.awt.Font("Arial", 1, 13));        emitZLabel.setText("Z");        anglePanel.setBorder(angleBorder);        anglePanel.setLayout(new GridBagLayout());        angleBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        angleLabel.setText("Degrees Off Direction:  0");        angleLabel.setFont(new java.awt.Font("Arial", 1, 13));        angleSlider.setValue(0);        angleSlider.setMinimum(0);        angleSlider.setMaximum(180);        angleSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = angleSlider.getValue();                particleMesh.setMaximumAngle((float) val * FastMath.DEG_TO_RAD);                updateAngleLabels();                regenCode();            }        });                minAngleLabel.setText("Min Degrees Off Direction:  0");        minAngleLabel.setFont(new java.awt.Font("Arial", 1, 13));        minAngleSlider.setValue(0);        minAngleSlider.setMinimum(0);        minAngleSlider.setMaximum(179);        minAngleSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = minAngleSlider.getValue();                particleMesh.setMinimumAngle((float) val                        * FastMath.DEG_TO_RAD);                updateAngleLabels();                regenCode();            }        });        randomPanel.setBorder(randomBorder);        randomPanel.setLayout(new GridBagLayout());        randomBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        randomLabel.setFont(new java.awt.Font("Arial", 1, 13));        randomLabel.setText("Random Factor: 0.0");        randomSlider.setValue(0);        randomSlider.setMaximum(100);        randomSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = randomSlider.getValue();                particleMesh.setRandomMod((float) val * .1f);                updateRandomLabels();                regenCode();            }        });        examplesPanel.setLayout(new GridBagLayout());        examplesLabel.setFont(new java.awt.Font("Arial", 1, 13));        examplesLabel.setText("Prebuilt Examples:");        exampleButton.setFont(new java.awt.Font("Arial", 0, 12));        exampleButton.setMargin(new Insets(2, 14, 2, 14));        exampleButton.setText("Apply");        exampleButton.setEnabled(false);        exampleButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                applyExample();            }        });        updateExampleModel();        exampleList = new JList(exampleModel);        exampleList.setFont(new java.awt.Font("Arial", 0, 13));        exampleList.addListSelectionListener(new ListSelectionListener() {            public void valueChanged(ListSelectionEvent e) {                if (exampleList.getSelectedValue() instanceof String)                    exampleButton.setEnabled(true);                else                    exampleButton.setEnabled(false);            }        });        codePanel.setFont(new java.awt.Font("Arial", 0, 13));        codePanel.setLayout(new GridBagLayout());        appPanel.setFont(new java.awt.Font("Arial", 0, 13));        emitPanel.setFont(new java.awt.Font("Arial", 0, 13));        worldPanel.setFont(new java.awt.Font("Arial", 0, 13));        examplesPanel.setFont(new java.awt.Font("Arial", 0, 13));        mainTabbedPane1.setFont(new java.awt.Font("Arial", 0, 13));        codeLabel.setFont(new java.awt.Font("Arial", 1, 13));        codeLabel.setText("Particle Code:");        codeTextArea.setFont(new java.awt.Font("Monospaced", 0, 10));        codeTextArea.setText("");        codeTextArea.setEditable(false);        codeTextArea.setAutoscrolls(true);        countPanel.setFont(new java.awt.Font("Arial", 0, 13));        countPanel.setBorder(countBorder);        countPanel.setLayout(new GridBagLayout());        countBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        countLabel.setFont(new java.awt.Font("Arial", 1, 13));        countLabel.setText("Particles: 300");        countButton.setFont(new java.awt.Font("Arial", 1, 12));        countButton.setMargin(new Insets(2, 2, 2, 2));        countButton.setText("Change...");        countButton.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(ActionEvent e) {                countButton_actionPerformed(e);            }        });        flowPanel.setFont(new java.awt.Font("Arial", 0, 13));        flowPanel.setLayout(new GridBagLayout());        ratePanel.setFont(new java.awt.Font("Arial", 0, 13));        ratePanel.setBorder(rateBorder);        ratePanel.setLayout(new GridBagLayout());        rateBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        rateLabel.setEnabled(false);        rateLabel.setFont(new java.awt.Font("Arial", 1, 13));        rateLabel.setText("Particles per second: 1000");        spawnPanel.setLayout(new GridBagLayout());        spawnPanel.setBorder(spawnBorder);        spawnBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        spawnBox.setSelected(true);        spawnBox.setText("Respawn \'dead\' particles.");        spawnBox.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                if (spawnBox.isSelected())                    particleMesh.getParticleController().setRepeatType(Controller.RT_WRAP);                else                    particleMesh.getParticleController()                            .setRepeatType(Controller.RT_CLAMP);            }        });        spawnButton.setFont(new java.awt.Font("Arial", 0, 12));        spawnButton.setText("Force Spawn");        spawnButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                particleMesh.forceRespawn();            }        });        rateVarLabel.setEnabled(false);        rateVarLabel.setFont(new java.awt.Font("Arial", 1, 13));        rateVarLabel.setText("Variance: 0%");        rateSlider.setMaximum(600);        rateSlider.setEnabled(false);        rateSlider.setValue(300);        rateSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = rateSlider.getValue();                particleMesh.setReleaseRate(val);                updateRateLabels();                regenCode();            }        });        rateVarSlider.setMaximum(100);        rateVarSlider.setEnabled(false);        rateVarSlider.setValue(0);        rateVarSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = rateVarSlider.getValue();                particleMesh                        .setReleaseVariance((float) val * .01f);                updateRateLabels();                regenCode();            }        });        rateBox.setFont(new java.awt.Font("Arial", 1, 13));        rateBox.setText("Regulate Flow");        rateBox.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(ActionEvent e) {                particleMesh.getParticleController().setControlFlow(rateBox.isSelected());                updateRateLabels();            }        });        velocityPanel.setLayout(new GridBagLayout());        velocityPanel.setBorder(velocityBorder);        velocityBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        velocityBorder.setBorder(BorderFactory.createEtchedBorder(new Color(                240, 217, 205), new Color(117, 106, 100)));        velocityLabel.setFont(new java.awt.Font("Arial", 1, 13));        velocityLabel.setText("Initial Velocity: .0001");        velocitySlider.setMaximum(1000);        velocitySlider.setValue(10);        velocitySlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = velocitySlider.getValue();                particleMesh                        .setInitialVelocity((float) val * .01f);                updateVelocityLabels();                regenCode();            }        });        spinPanel.setLayout(new GridBagLayout());        spinPanel.setBorder(spinBorder);        spinBorder.setTitleFont(new java.awt.Font("Arial", 0, 10));        spinBorder.setBorder(BorderFactory.createEtchedBorder(new Color(240,                217, 205), new Color(117, 106, 100)));        spinLabel.setFont(new java.awt.Font("Arial", 1, 13));        spinLabel.setText("Spin Speed: .0001");        spinSlider.setMaximum(50);        spinSlider.setMinimum(-50);        spinSlider.setValue(0);        spinSlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                int val = spinSlider.getValue();                particleMesh                        .setParticleSpinSpeed((float) val * .01f);                updateSpinLabels();                regenCode();            }        });        final GridBagConstraints gridBagConstraints = new GridBagConstraints();        gridBagConstraints.weightx = 0.1;        gridBagConstraints.insets = new Insets(0, 0, 0, 0);        gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;        gridBagConstraints.fill = GridBagConstraints.BOTH;        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        this.getContentPane().add(mainTabbedPane1, gridBagConstraints);        emitPanel.add(directionPanel, new GridBagConstraints(0, 0, 1, 1, 0.5,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(10, 10, 5, 5), 0, 0));        emitPanel.add(velocityPanel, new GridBagConstraints(0, 2, 1, 1, 0.5,                0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(5, 5, 10, 10), 0, 0));        emitPanel.add(spinPanel, new GridBagConstraints(0, 3, 1, 1, 0.5, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        5, 5, 10, 10), 0, 0));        directionPanel.add(emitXSlider, new GridBagConstraints(0, 0, 1, 1, 0.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(10, 10, 5, 0), 0, 0));        directionPanel.add(emitYSlider, new GridBagConstraints(1, 0, 1, 1, 0.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(10, 0, 5, 0), 0, 0));        directionPanel.add(emitZSlider, new GridBagConstraints(2, 0, 1, 1, 0.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(10, 0, 5, 10), 0, 0));        directionPanel.add(emitXLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 0, 0));        directionPanel.add(emitYLabel, new GridBagConstraints(1, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 0, 0));        directionPanel.add(emitZLabel, new GridBagConstraints(2, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 5), 0, 0));        worldPanel.add(speedPanel, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        10, 10, 5, 5), 0, 0));        startAlphaSpinner.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                particleMesh.getStartColor().a = (Integer                        .parseInt(startAlphaSpinner.getValue().toString()) / 255f);                regenCode();            }        });        endAlphaSpinner.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                particleMesh.getEndColor().a = (Integer                        .parseInt(endAlphaSpinner.getValue().toString()) / 255f);                regenCode();            }        });        appPanel.add(colorPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        10, 10, 5, 5), 0, 0));        colorPanel.add(startColorLabel, new GridBagConstraints(0, 0, 2, 1, 0.0,                0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(5, 10, 0, 10), 0, 0));        colorPanel.add(colorLabel, new GridBagConstraints(2, 0, 1, 3, 0.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(                        0, 5, 0, 5), 0, 0));        colorPanel.add(endColorLabel, new GridBagConstraints(3, 0, 2, 1, 0.0,                0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,                new Insets(5, 10, 0, 10), 0, 0));        colorPanel.add(startColorPanel, new GridBagConstraints(0, 1, 2, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 25, 25));        colorPanel.add(endColorPanel, new GridBagConstraints(3, 1, 2, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 25, 25));        colorPanel.add(startColorHex, new GridBagConstraints(0, 2, 2, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 4, 0), 0, 0));        colorPanel.add(endColorHex, new GridBagConstraints(3, 2, 2, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 4, 0), 0, 0));        colorPanel.add(startAlphaSpinner, new GridBagConstraints(1, 3, 1, 1,                0.25, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 20, 0));        colorPanel.add(startAlphaLabel, new GridBagConstraints(0, 3, 1, 1,                0.25, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 0, 0));        colorPanel.add(endAlphaLabel, new GridBagConstraints(3, 3, 1, 1, 0.25,                0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 0, 0));        colorPanel.add(endAlphaSpinner, new GridBagConstraints(4, 3, 1, 1,                0.25, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 20, 0));        appPanel.add(sizePanel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        10, 5, 5, 10), 0, 0));        sizePanel.add(startSizeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,                0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(0, 4, 0, 0), 0, 0));        sizePanel.add(startSizeSlider, new GridBagConstraints(0, 1, 1, 1, 1.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,                new Insets(0, 4, 0, 0), 100, 0));        sizePanel.add(endSizeLabel, new GridBagConstraints(0, 2, 1, 1, 0.0,                0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(4, 4, 0, 0), 0, 0));        sizePanel.add(endSizeSlider, new GridBagConstraints(0, 3, 1, 1, 1.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,                new Insets(0, 4, 0, 0), 100, 0));        appPanel.add(texturePanel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        5, 10, 5, 5), 0, 0));        texturePanel.add(textureLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(10, 10, 5, 5), 0, 0));        texturePanel.add(changeTextureButton, new GridBagConstraints(0, 1, 1,                1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,                new Insets(5, 10, 10, 5), 0, 0));        texturePanel.add(imageLabel, new GridBagConstraints(1, 0, 1, 2, 1.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(5, 5, 5, 5), 0, 0));        appPanel.add(countPanel, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        5, 5, 5, 10), 0, 0));        speedPanel.add(speedLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(                        10, 10, 0, 10), 0, 0));        speedPanel.add(speedSlider, new GridBagConstraints(0, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,                new Insets(0, 5, 5, 5), 0, 0));        worldPanel.add(gravityPanel, new GridBagConstraints(0, 3, 1, 3, 0.5,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(10, 5, 10, 10), 0, 0));        gravityPanel.add(gravXSlider, new GridBagConstraints(0, 0, 1, 1, 0.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(0, 0, 0, 0), 0, 0));        gravityPanel.add(gravYSlider, new GridBagConstraints(1, 0, 1, 1, 0.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(0, 0, 0, 0), 0, 0));        gravityPanel.add(gravZSlider, new GridBagConstraints(2, 0, 1, 1, 0.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(0, 0, 0, 0), 0, 0));        gravityPanel.add(gravXLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 0, 0));        gravityPanel.add(gravYLabel, new GridBagConstraints(1, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 0, 0));        gravityPanel.add(gravZLabel, new GridBagConstraints(2, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(0, 0, 0, 0), 0, 0));        worldPanel.add(agePanel, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        5, 10, 5, 5), 0, 0));        agePanel.add(minAgeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,                        5, 5, 0), 0, 0));        agePanel.add(minAgeSlider, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,                GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,                new Insets(0, 5, 5, 5), 0, 0));        agePanel.add(maxAgeLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,                        5, 5, 0), 0, 0));        agePanel.add(maxAgeSlider, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,                GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,                new Insets(0, 5, 5, 5), 0, 0));        worldPanel.add(randomPanel, new GridBagConstraints(0, 2, 1, 1, 0.5,                0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(5, 10, 10, 5), 0, 0));        emitPanel.add(anglePanel, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        5, 10, 10, 5), 0, 0));        anglePanel.add(angleLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        10, 10, 5, 10), 0, 0));        anglePanel.add(angleSlider, new GridBagConstraints(0, 1, 1, 1, 1.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,                new Insets(5, 10, 5, 10), 0, 0));        anglePanel.add(minAngleLabel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        10, 10, 5, 10), 0, 0));        anglePanel.add(minAngleSlider, new GridBagConstraints(0, 3, 1, 1, 1.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,                new Insets(5, 10, 5, 10), 0, 0));        randomPanel.add(randomLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,                0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(5, 10, 5, 10), 0, 0));        randomPanel.add(randomSlider, new GridBagConstraints(0, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,                new Insets(0, 5, 5, 5), 0, 0));        examplesPanel.add(examplesLabel, new GridBagConstraints(0, 0, 1, 1,                0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(10, 10, 5, 10), 0, 0));        examplesPanel.add(exampleSP, new GridBagConstraints(0, 1, 1, 1, 1.0,                1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(0, 10, 0, 10), 0, 0));        examplesPanel.add(exampleButton, new GridBagConstraints(0, 2, 1, 1,                0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(5, 10, 10, 10), 0, 0));        exampleSP.setViewportView(exampleList);        codePanel.add(codeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(                        10, 10, 5, 10), 0, 0));        final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();        gridBagConstraints_2.gridy = 0;        gridBagConstraints_2.gridx = 1;        codePanel.add(getSaveAsjmeButton(), gridBagConstraints_2);        codePanel.add(codeSP, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0,                GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,                new Insets(5, 10, 10, 10), 0, 0));        countPanel.add(countLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(                        10, 10, 5, 10), 0, 0));        countPanel.add(countButton, new GridBagConstraints(0, 1, 1, 1, 1.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(5, 10, 10, 10), 0, 0));        codeSP.setViewportView(codeTextArea);        mainTabbedPane1.add(appPanel, "Appearance");        mainTabbedPane1.add(emitPanel, "Emission");        mainTabbedPane1.add(flowPanel, "Flow");        mainTabbedPane1.add(worldPanel, "World");        mainTabbedPane1.add(examplesPanel, "Examples");        mainTabbedPane1.add(codePanel, "Code");        flowPanel.add(ratePanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        10, 10, 5, 10), 0, 0));        flowPanel.add(spawnPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        10, 5, 10, 10), 0, 0));        spawnPanel.add(spawnBox, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(                        10, 10, 5, 10), 0, 0));        spawnPanel.add(spawnButton, new GridBagConstraints(0, 1, 1, 1, 0.0,                0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,                new Insets(5, 10, 10, 10), 0, 0));        ratePanel.add(rateLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,                        10, 0, 10), 0, 0));        ratePanel.add(rateSlider, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,                new Insets(5, 10, 10, 10), 0, 0));        ratePanel.add(rateVarLabel, new GridBagConstraints(0, 3, 1, 1, 0.0,                0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(5, 10, 0, 10), 0, 0));        ratePanel.add(rateVarSlider, new GridBagConstraints(0, 4, 1, 1, 1.0,                0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,                new Insets(5, 10, 10, 10), 0, 0));        ratePanel.add(rateBox, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(                        10, 10, 5, 10), 0, 0));        velocityPanel.add(velocityLabel, new GridBagConstraints(0, 0, 1, 1,                1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,                new Insets(10, 10, 5, 10), 0, 0));        velocityPanel.add(velocitySlider, new GridBagConstraints(0, 1, 1, 1,                1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,                new Insets(5, 10, 10, 10), 0, 0));        spinPanel.add(spinLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,                GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(                        10, 10, 5, 10), 0, 0));        spinPanel.add(spinSlider, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(                        5, 10, 10, 10), 0, 0));        setSize(new Dimension(800, 600));        final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();        gridBagConstraints_1.weightx = .9;        gridBagConstraints_1.weighty = 1.0;        gridBagConstraints_1.fill = GridBagConstraints.BOTH;        gridBagConstraints_1.anchor = GridBagConstraints.NORTHWEST;        gridBagConstraints_1.gridx = 1;        gridBagConstraints_1.gridy = 0;        getContentPane().add(getGlCanvas(), gridBagConstraints_1);    }