List of usage examples for javax.swing SpinnerNumberModel SpinnerNumberModel
public SpinnerNumberModel(double value, double minimum, double maximum, double stepSize)
SpinnerNumberModel
with the specified value
, minimum
/maximum
bounds, and stepSize
. From source file:com.alvermont.terraj.planet.ui.MainFrame.java
/** This method is called from within the constructor to * initialize the form./*from w w w .ja v a 2 s .c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); projPanel = new javax.swing.JPanel(); projComboBox = new javax.swing.JComboBox<Projector>(); jLabel1 = new javax.swing.JLabel(); latSpinner = new javax.swing.JSpinner(); lonSpinner = new javax.swing.JSpinner(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); previewLabel = new javax.swing.JLabel(); heightfieldCheckbox = new javax.swing.JCheckBox(); jLabel17 = new javax.swing.JLabel(); NumberFormat format = NumberFormat.getInstance(); format.setMinimumFractionDigits(12); format.setMaximumFractionDigits(12); seedField = new JFormattedTextField(format); randomSeedButton = new javax.swing.JButton(); randomAllButton = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); vgridSpinner = new javax.swing.JSpinner(); hgridSpinner = new javax.swing.JSpinner(); outputJPanel = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); widthComboBox = new javax.swing.JComboBox<String>(); heightComboBox = new javax.swing.JComboBox<String>(); reverseCheckbox = new javax.swing.JCheckBox(); jLabel18 = new javax.swing.JLabel(); scaleSpinner = new javax.swing.JSpinner(); jPanel3 = new javax.swing.JPanel(); oceanColourButton = new javax.swing.JButton(); shoreColourButton = new javax.swing.JButton(); lowColourButton = new javax.swing.JButton(); highColourButton = new javax.swing.JButton(); mountainColourButton = new javax.swing.JButton(); rockyColourButton = new javax.swing.JButton(); peakColourButton = new javax.swing.JButton(); spaceColourButton = new javax.swing.JButton(); lineColourButton = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); randomAllColourButton = new javax.swing.JButton(); randomOceanColourButton = new javax.swing.JButton(); randomShoreColourButton = new javax.swing.JButton(); randomLowColourButton = new javax.swing.JButton(); randomHighColourButton = new javax.swing.JButton(); randomMountainColourButton = new javax.swing.JButton(); randomRockyColourButton = new javax.swing.JButton(); randomPeakColourButton = new javax.swing.JButton(); randomSpaceColourButton = new javax.swing.JButton(); randomLineColourButton = new javax.swing.JButton(); optionsPanel = new javax.swing.JPanel(); altColourCheckbox = new javax.swing.JCheckBox(); laticCheckbox = new javax.swing.JCheckBox(); shadeCheckbox = new javax.swing.JCheckBox(); shadeAngleSpinner = new javax.swing.JSpinner(); lighterSpinner = new javax.swing.JSpinner(); jLabel19 = new javax.swing.JLabel(); outlineCheckbox = new javax.swing.JCheckBox(); edgesCheckbox = new javax.swing.JCheckBox(); jMenuBar1 = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); loadParamsItem = new javax.swing.JMenuItem(); saveParamsItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); exitItem = new javax.swing.JMenuItem(); optionsMenu = new javax.swing.JMenu(); nativeLAFCheckbox = new javax.swing.JCheckBoxMenuItem(); helpMenu = new javax.swing.JMenu(); aboutItem = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Terrain Generator"); jButton1.setAction(new GenerateAction(this, "Generate")); jButton1.setText("Generate ..."); jButton1.setToolTipText("Generate the terrain using the parameters you have set up"); jButton1.setPreferredSize(new java.awt.Dimension(120, 23)); jTabbedPane1.setToolTipText(""); projPanel.setRequestFocusEnabled(false); projComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { projComboBoxActionPerformed(evt); } }); jLabel1.setText("Projection Type"); jLabel1.setToolTipText("Specify the map projection to be used"); latSpinner.setModel(new SpinnerNumberModel(0.0, -90.0, 90.0, 0.001)); latSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { latSpinnerStateChanged(evt); } }); lonSpinner.setModel(new SpinnerNumberModel(0.0, -180.0, 180.0, 0.001)); lonSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { lonSpinnerStateChanged(evt); } }); jLabel2.setText("Latitude"); jLabel2.setToolTipText("Set the latitude for the projection"); jLabel3.setText("Longitude"); jLabel3.setToolTipText("Set the longitude for the projection"); previewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); previewLabel.setText("Not Initialized!"); previewLabel.setToolTipText("A preview of the map projection"); previewLabel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); heightfieldCheckbox.setText("Don't use a projection, generate heightfield output"); heightfieldCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); heightfieldCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); heightfieldCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { heightfieldCheckboxActionPerformed(evt); } }); jLabel17.setText("Seed value for random terrain generation"); jLabel17.setToolTipText("Set the seed value. A particular seed will produce the same terrain"); seedField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); seedField.setText("0.0"); seedField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { seedFieldActionPerformed(evt); } }); randomSeedButton.setText("Random Seed"); randomSeedButton.setToolTipText("Pick a random seed value"); randomSeedButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomSeedButtonActionPerformed(evt); } }); randomAllButton.setText("Randomize All"); randomAllButton.setToolTipText("Randomize all the items on this page"); randomAllButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomAllButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout projPanelLayout = new org.jdesktop.layout.GroupLayout(projPanel); projPanel.setLayout(projPanelLayout); projPanelLayout.setHorizontalGroup(projPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, projPanelLayout.createSequentialGroup() .addContainerGap() .add(projPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, previewLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 662, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, heightfieldCheckbox) .add(projPanelLayout.createSequentialGroup() .add(projPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel1).add(jLabel2).add(jLabel3).add(jLabel17)) .add(145, 145, 145) .add(projPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, lonSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, latSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, projComboBox, 0, 318, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, seedField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, projPanelLayout .createSequentialGroup().add(randomSeedButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 116, Short.MAX_VALUE) .add(randomAllButton))))) .addContainerGap())); projPanelLayout.setVerticalGroup(projPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(projPanelLayout.createSequentialGroup().addContainerGap() .add(projPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1).add(projComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(projPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(latSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel2)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(projPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(lonSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel3)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(projPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel17).add(seedField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(projPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(randomAllButton).add(randomSeedButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(previewLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(heightfieldCheckbox) .addContainerGap())); jTabbedPane1.addTab("Project", null, projPanel, "Set the projection parameters"); jLabel4.setText("Add a grid at this vertical spacing in degrees (0 = none)"); jLabel5.setText("Add a grid at this horizontal spacing in degrees (0 = none)"); vgridSpinner.setModel(new SpinnerNumberModel(0.0, -90.0, 90.0, 0.001)); vgridSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { vgridSpinnerStateChanged(evt); } }); hgridSpinner.setModel(new SpinnerNumberModel(0.0, -180.0, 180.0, 0.001)); hgridSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { hgridSpinnerStateChanged(evt); } }); org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup().addContainerGap() .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel4) .add(jLabel5)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 290, Short.MAX_VALUE) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(hgridSpinner).add(vgridSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup().addContainerGap() .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel4).add(vgridSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel5).add(hgridSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(334, Short.MAX_VALUE))); jTabbedPane1.addTab("Grid", null, jPanel1, "Set the grid parameters"); jLabel6.setText("Output width in pixels"); jLabel7.setText("Output height in pixels"); widthComboBox.setEditable(true); widthComboBox.setModel(new javax.swing.DefaultComboBoxModel<>( new String[] { "320", "640", "800", "1024", "1280", "1600" })); widthComboBox.setSelectedIndex(2); widthComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { widthComboBoxActionPerformed(evt); } }); heightComboBox.setEditable(true); heightComboBox.setModel( new javax.swing.DefaultComboBoxModel<>(new String[] { "200", "480", "600", "1024", "1200" })); heightComboBox.setSelectedIndex(2); heightComboBox.addActionListener(evt -> heightComboBoxActionPerformed(evt)); /*new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { heightComboBoxActionPerformed(evt); } });*/ reverseCheckbox.setText("Reverse the background on the output"); reverseCheckbox.setToolTipText("If selected will invert the background colour"); reverseCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); reverseCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); jLabel18.setText("Scale (1.0 = normal)"); scaleSpinner.setModel(new SpinnerNumberModel(1.0, 0.01, 10.0, 0.01)); scaleSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { scaleSpinnerStateChanged(evt); } }); org.jdesktop.layout.GroupLayout outputJPanelLayout = new org.jdesktop.layout.GroupLayout(outputJPanel); outputJPanel.setLayout(outputJPanelLayout); outputJPanelLayout.setHorizontalGroup(outputJPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(outputJPanelLayout.createSequentialGroup().addContainerGap().add(outputJPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(outputJPanelLayout.createSequentialGroup() .add(outputJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel6).add(jLabel7)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 458, Short.MAX_VALUE) .add(outputJPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(heightComboBox, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(widthComboBox, 0, 85, Short.MAX_VALUE))) .add(outputJPanelLayout.createSequentialGroup().add(jLabel18) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 401, Short.MAX_VALUE) .add(scaleSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 163, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(reverseCheckbox)).addContainerGap())); outputJPanelLayout.setVerticalGroup(outputJPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(outputJPanelLayout.createSequentialGroup().addContainerGap() .add(outputJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel6).add(widthComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(outputJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel7).add(heightComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(outputJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel18).add(scaleSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(reverseCheckbox) .addContainerGap(283, Short.MAX_VALUE))); jTabbedPane1.addTab("Output", null, outputJPanel, "Set the output parameters"); oceanColourButton.setText("Select ..."); oceanColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { oceanColourButtonActionPerformed(evt); } }); shoreColourButton.setText("Select ..."); shoreColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { shoreColourButtonActionPerformed(evt); } }); lowColourButton.setText("Select ..."); lowColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { lowColourButtonActionPerformed(evt); } }); highColourButton.setText("Select ..."); highColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { highColourButtonActionPerformed(evt); } }); mountainColourButton.setText("Select ..."); mountainColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mountainColourButtonActionPerformed(evt); } }); rockyColourButton.setText("Select ..."); rockyColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rockyColourButtonActionPerformed(evt); } }); peakColourButton.setText("Select ..."); peakColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { peakColourButtonActionPerformed(evt); } }); spaceColourButton.setText("Select ..."); spaceColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { spaceColourButtonActionPerformed(evt); } }); lineColourButton.setText("Select ..."); lineColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { lineColourButtonActionPerformed(evt); } }); jLabel8.setText("Colour to use for ocean depths"); jLabel9.setText("Colour to use for shores"); jLabel10.setText("Colour to use for lowlands"); jLabel11.setText("Colour to use for highlands"); jLabel12.setText("Colour to use for mountains"); jLabel13.setText("Colour to use for high rocky peaks"); jLabel14.setText("Colour to use for peaks"); jLabel15.setText("Colour to use for space"); jLabel16.setText("Colour to use for lines"); randomAllColourButton.setText("Randomize All Colours"); randomAllColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomAllColourButtonActionPerformed(evt); } }); randomOceanColourButton.setText("Random"); randomOceanColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomOceanColourButtonActionPerformed(evt); } }); randomShoreColourButton.setText("Random"); randomShoreColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomShoreColourButtonActionPerformed(evt); } }); randomLowColourButton.setText("Random"); randomLowColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomLowColourButtonActionPerformed(evt); } }); randomHighColourButton.setText("Random"); randomHighColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomHighColourButtonActionPerformed(evt); } }); randomMountainColourButton.setText("Random"); randomMountainColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomMountainColourButtonActionPerformed(evt); } }); randomRockyColourButton.setText("Random"); randomRockyColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomRockyColourButtonActionPerformed(evt); } }); randomPeakColourButton.setText("Random"); randomPeakColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomPeakColourButtonActionPerformed(evt); } }); randomSpaceColourButton.setText("Random"); randomSpaceColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomSpaceColourButtonActionPerformed(evt); } }); randomLineColourButton.setText("Random"); randomLineColourButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { randomLineColourButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout .setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap().add(jPanel3Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add( jPanel3Layout .createSequentialGroup().add( jPanel3Layout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel8).add(jLabel9).add(jLabel10) .add(jLabel11).add(jLabel12).add(jLabel13) .add(jLabel14).add(jLabel15).add(jLabel16)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 222, Short.MAX_VALUE) .add(jPanel3Layout .createParallelGroup( org.jdesktop.layout.GroupLayout.TRAILING) .add(randomOceanColourButton).add(randomShoreColourButton) .add(randomLowColourButton).add(randomMountainColourButton) .add(randomRockyColourButton).add( randomPeakColourButton) .add(randomSpaceColourButton).add(randomLineColourButton) .add(randomHighColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING, false) .add(org.jdesktop.layout.GroupLayout.TRAILING, oceanColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, shoreColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, lowColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, highColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, mountainColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, rockyColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, peakColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, spaceColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, lineColourButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, randomAllColourButton)) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(oceanColourButton).add(jLabel8).add(randomOceanColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(shoreColourButton).add(jLabel9).add(randomShoreColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(lowColourButton).add(jLabel10).add(randomLowColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(highColourButton).add(jLabel11).add(randomHighColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(mountainColourButton).add(jLabel12).add(randomMountainColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(rockyColourButton).add(jLabel13).add(randomRockyColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(peakColourButton).add(jLabel14).add(randomPeakColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(spaceColourButton).add(jLabel15).add(randomSpaceColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(lineColourButton).add(jLabel16).add(randomLineColourButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 91, Short.MAX_VALUE) .add(randomAllColourButton).addContainerGap())); jTabbedPane1.addTab("Colours", null, jPanel3, "Set the colour parameters"); altColourCheckbox.setText("Use an alternative colouring scheme"); altColourCheckbox.setToolTipText("An alternate colour scheme more like an atlas"); altColourCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); altColourCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); altColourCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { altColourCheckboxActionPerformed(evt); } }); laticCheckbox.setText("Use latitude based colouring"); laticCheckbox.setToolTipText("Colour terrain based on latitude"); laticCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); laticCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); laticCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { laticCheckboxActionPerformed(evt); } }); shadeCheckbox.setText("Do shading with light angle (degrees)"); shadeCheckbox.setToolTipText("Use bumpmap shading on the terrain"); shadeCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); shadeCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); shadeCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { shadeCheckboxActionPerformed(evt); } }); shadeAngleSpinner.setModel(new SpinnerNumberModel(150.0, 0.0, 360.0, 0.1)); shadeAngleSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { shadeAngleSpinnerStateChanged(evt); } }); lighterSpinner.setModel(new SpinnerNumberModel(0, 0, 100, 1)); lighterSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { lighterSpinnerStateChanged(evt); } }); jLabel19.setText("Lighten colours by this amount (doesn't work with alt colours)"); jLabel19.setToolTipText("Use lighter colouring"); outlineCheckbox.setText("Draw in outline mode only"); outlineCheckbox.setToolTipText("Draw a black and white coastline output only"); outlineCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); outlineCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); outlineCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { outlineCheckboxActionPerformed(evt); } }); edgesCheckbox.setText("Draw the edges of coastlines in black"); edgesCheckbox.setToolTipText("Outline the coasts in black"); edgesCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); edgesCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); edgesCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { edgesCheckboxActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout optionsPanelLayout = new org.jdesktop.layout.GroupLayout(optionsPanel); optionsPanel.setLayout(optionsPanelLayout); optionsPanelLayout.setHorizontalGroup(optionsPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(optionsPanelLayout.createSequentialGroup().addContainerGap().add(optionsPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(altColourCheckbox) .add(laticCheckbox) .add(optionsPanelLayout.createSequentialGroup().add(shadeCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 304, Short.MAX_VALUE) .add(shadeAngleSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 163, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(org.jdesktop.layout.GroupLayout.TRAILING, optionsPanelLayout.createSequentialGroup().add(17, 17, 17).add(jLabel19) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 189, Short.MAX_VALUE) .add(lighterSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 163, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(optionsPanelLayout.createSequentialGroup().add(17, 17, 17).add(outlineCheckbox)) .add(edgesCheckbox)).addContainerGap())); optionsPanelLayout.setVerticalGroup(optionsPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(optionsPanelLayout.createSequentialGroup().addContainerGap().add(altColourCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(laticCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(shadeCheckbox).add(shadeAngleSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(lighterSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel19)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(edgesCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(outlineCheckbox) .addContainerGap(250, Short.MAX_VALUE))); optionsPanelLayout.linkSize(new java.awt.Component[] { altColourCheckbox, laticCheckbox, shadeCheckbox }, org.jdesktop.layout.GroupLayout.VERTICAL); jTabbedPane1.addTab("Options", null, optionsPanel, "Set the rest of the options"); fileMenu.setText("File"); loadParamsItem.setText("Load Settings ..."); loadParamsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadParamsItemActionPerformed(evt); } }); fileMenu.add(loadParamsItem); saveParamsItem.setText("Save Settings ..."); saveParamsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveParamsItemActionPerformed(evt); } }); fileMenu.add(saveParamsItem); fileMenu.add(jSeparator1); exitItem.setText("Exit ..."); exitItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitItemActionPerformed(evt); } }); fileMenu.add(exitItem); jMenuBar1.add(fileMenu); optionsMenu.setText("Options"); nativeLAFCheckbox.setText("Use system look and feel"); nativeLAFCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nativeLAFCheckboxActionPerformed(evt); } }); optionsMenu.add(nativeLAFCheckbox); jMenuBar1.add(optionsMenu); helpMenu.setText("Help"); aboutItem.setText("About ..."); aboutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { aboutItemActionPerformed(evt); } }); helpMenu.add(aboutItem); jMenuBar1.add(helpMenu); setJMenuBar(jMenuBar1); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup().addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 687, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup().addContainerGap() .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap())); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 715) / 2, (screenSize.height - 515) / 2, 715, 515); }
From source file:org.pf.midea.MainUI.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents menuMain = new JMenuBar(); menuFile = new JMenu(); menuItemQuit = new JMenuItem(); menuTools = new JMenu(); menuConstellations = new JMenu(); menuItemASK = new JMenuItem(); menuItemFSK = new JMenuItem(); menuItemBPSK = new JMenuItem(); menuItemQPSK = new JMenuItem(); menuItem8PSK = new JMenuItem(); menuItem16PSK = new JMenuItem(); menuItem32PSK = new JMenuItem(); menuItem16QAM = new JMenuItem(); menuItem32QAM = new JMenuItem(); menuItem64QAM = new JMenuItem(); menuItem256QAM = new JMenuItem(); menuHelp = new JMenu(); menuItemAbout = new JMenuItem(); labelSource = new JLabel(); SourceCell[] sourceCells = { new SourceCell(PlanStates.SourceType.ST_TEST), new SourceCell(PlanStates.SourceType.ST_RANDOM) }; chooserSource = new JComboBox(sourceCells); chooserSource.setRenderer(new SourceCellRenderer()); buttonAddToPlan = new JButton(); panelPlan = new JPanel(); scrollPane1 = new JScrollPane(); listPlan = new JList(); labelCode = new JLabel(); CodeCell[] codeCells = { new CodeCell(PlanStates.CodeType.CT_NONE), new CodeCell(PlanStates.CodeType.CT_HAMMING74), new CodeCell(PlanStates.CodeType.CT_CYCLIC), new CodeCell(PlanStates.CodeType.CT_BCH155) }; chooserCode = new JComboBox(codeCells); chooserCode.setRenderer(new CodeCellRenderer()); labelModulation = new JLabel(); ModulationCell[] modulationCells = { new ModulationCell(PlanStates.ModulationType.MT_ASK), new ModulationCell(PlanStates.ModulationType.MT_FSK), new ModulationCell(PlanStates.ModulationType.MT_BPSK), new ModulationCell(PlanStates.ModulationType.MT_QPSK), new ModulationCell(PlanStates.ModulationType.MT_8PSK), new ModulationCell(PlanStates.ModulationType.MT_16PSK), new ModulationCell(PlanStates.ModulationType.MT_32PSK), new ModulationCell(PlanStates.ModulationType.MT_16QAM), new ModulationCell(PlanStates.ModulationType.MT_32QAM), new ModulationCell(PlanStates.ModulationType.MT_64QAM), new ModulationCell(PlanStates.ModulationType.MT_256QAM) }; chooserModulation = new JComboBox(modulationCells); chooserModulation.setRenderer(new ModulationCellRenderer()); labelChannel = new JLabel(); ChannelCell[] channelCells = { new ChannelCell(PlanStates.ChannelType.CHT_AWGN), new ChannelCell(PlanStates.ChannelType.CHT_RAYLEIGH) }; chooserChannel = new JComboBox(channelCells); chooserChannel.setRenderer(new ChannelCellRenderer()); buttonClearPlan = new JButton(); labelErrors = new JLabel(); ErrorsCell[] errorCells = { new ErrorsCell(PlanStates.ErrorsType.ET_SER), new ErrorsCell(PlanStates.ErrorsType.ET_BER) }; chooserErrors = new JComboBox(errorCells); chooserErrors.setRenderer(new ErrorsCellRenderer()); labelLineWidth = new JLabel(); spinnerLineWidth = new JSpinner(); buttonRemoveFromPlan = new JButton(); labelLineColor = new JLabel(); ColorCell[] colorCells = { new ColorCell(null), new ColorCell(Color.black), new ColorCell(Color.red), new ColorCell(Color.green), new ColorCell(Color.blue) }; chooserLineColor = new JComboBox(colorCells); chooserLineColor.setRenderer(new ColorCellRenderer()); labelHSquare = new JLabel(); spinnerHSquareLow = new JSpinner(); labelEllipsis = new JLabel(); spinnerHSquareHigh = new JSpinner(); panelInner1 = new JPanel(); labelHSquareStep = new JLabel(); spinnerHSquareStep = new JSpinner(); labelMeasurementUnit = new JLabel(); radioButtonMeasurementUnitTimes = new JRadioButton(); radioButtonMeasurementUnitdB = new JRadioButton(); buttonRunSimulation = new JButton(); labelIterations = new JLabel(); spinnerIterations = new JSpinner(); checkBoxShowLineNumbers = new JCheckBox(); tabbedPaneResults = new JTabbedPane(); panelChart = new JPanel(); panelNumeric = new JPanel(); scrollPane2 = new JScrollPane(); textAreaNumeric = new JTextArea(); progressBar = new JProgressBar(); //======== this ======== setLayout(new FormLayout("3*(default, $lcgap), 36dlu, $lcgap, 122dlu:grow", "[21px,default], 9*($lgap, default), $lgap, default:grow, $lgap, default")); //======== menuMain ======== {// www . j ava 2 s .c o m //======== menuFile ======== { menuFile.setText("\u0424\u0430\u0439\u043b"); //---- menuItemQuit ---- menuItemQuit.setText("\u0412\u0438\u0439\u0442\u0438"); menuItemQuit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_MASK)); menuItemQuit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItemQuitActionPerformed(e); } }); menuFile.add(menuItemQuit); } menuMain.add(menuFile); //======== menuTools ======== { menuTools.setText("\u0406\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438"); //======== menuConstellations ======== { menuConstellations.setText( "\u0421\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u0456 \u0441\u0443\u0437\u0456\u0440\u2019\u044f"); //---- menuItemASK ---- menuItemASK.setText("\u0410\u041c\u043d\u2026"); menuItemASK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItemASKActionPerformed(e); } }); menuConstellations.add(menuItemASK); //---- menuItemFSK ---- menuItemFSK.setText("\u0427\u041c\u043d\u2026"); menuItemFSK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItemFSKActionPerformed(e); } }); menuConstellations.add(menuItemFSK); //---- menuItemBPSK ---- menuItemBPSK.setText("\u0424\u041c\u043d\u2026"); menuItemBPSK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItemBPSKActionPerformed(e); } }); menuConstellations.add(menuItemBPSK); //---- menuItemQPSK ---- menuItemQPSK.setText("\u0424\u041c-4\u2026"); menuItemQPSK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItemQPSKActionPerformed(e); } }); menuConstellations.add(menuItemQPSK); //---- menuItem8PSK ---- menuItem8PSK.setText("\u0424\u041c-8\u2026"); menuItem8PSK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem8PSKActionPerformed(e); } }); menuConstellations.add(menuItem8PSK); //---- menuItem16PSK ---- menuItem16PSK.setText("\u0424\u041c-16\u2026"); menuItem16PSK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem16PSKActionPerformed(e); } }); menuConstellations.add(menuItem16PSK); //---- menuItem32PSK ---- menuItem32PSK.setText("\u0424\u041c-32\u2026"); menuItem32PSK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem32PSKActionPerformed(e); } }); menuConstellations.add(menuItem32PSK); //---- menuItem16QAM ---- menuItem16QAM.setText("\u041a\u0410\u041c-16\u2026"); menuItem16QAM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem16QAMActionPerformed(e); } }); menuConstellations.add(menuItem16QAM); //---- menuItem32QAM ---- menuItem32QAM.setText("\u041a\u0410\u041c-32\u2026"); menuItem32QAM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem32QAMActionPerformed(e); } }); menuConstellations.add(menuItem32QAM); //---- menuItem64QAM ---- menuItem64QAM.setText("\u041a\u0410\u041c-64\u2026"); menuItem64QAM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem64QAMActionPerformed(e); } }); menuConstellations.add(menuItem64QAM); //---- menuItem256QAM ---- menuItem256QAM.setText("\u041a\u0410\u041c-256\u2026"); menuItem256QAM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem256QAMActionPerformed(e); } }); menuConstellations.add(menuItem256QAM); } menuTools.add(menuConstellations); } menuMain.add(menuTools); //======== menuHelp ======== { menuHelp.setText("\u0414\u043e\u0432\u0456\u0434\u043a\u0430"); //---- menuItemAbout ---- menuItemAbout.setText("\u041f\u0440\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0443\u2026"); menuItemAbout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItemAboutActionPerformed(e); } }); menuHelp.add(menuItemAbout); } menuMain.add(menuHelp); } add(menuMain, CC.xywh(1, 1, 9, 1, CC.FILL, CC.FILL)); //---- labelSource ---- labelSource.setText("\u0414\u0436\u0435\u0440\u0435\u043b\u043e:"); add(labelSource, CC.xy(1, 3)); add(chooserSource, CC.xy(3, 3)); //---- buttonAddToPlan ---- buttonAddToPlan.setText("\u2192"); buttonAddToPlan.setToolTipText( "\u0414\u043e\u0434\u0430\u0442\u0438 \u0434\u043e \u043f\u043b\u0430\u043d\u0443 \u0435\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0443"); buttonAddToPlan.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { buttonAddToPlanActionPerformed(e); } }); add(buttonAddToPlan, CC.xywh(5, 3, 1, 5)); //======== panelPlan ======== { panelPlan.setLayout(new GridLayout()); //======== scrollPane1 ======== { scrollPane1.setViewportView(listPlan); } panelPlan.add(scrollPane1); } add(panelPlan, CC.xywh(7, 3, 3, 13)); //---- labelCode ---- labelCode.setText("\u041a\u043e\u0434:"); add(labelCode, CC.xy(1, 5)); add(chooserCode, CC.xy(3, 5)); //---- labelModulation ---- labelModulation.setText("\u041c\u043e\u0434\u0443\u043b\u044f\u0446\u0456\u044f:"); add(labelModulation, CC.xy(1, 7)); add(chooserModulation, CC.xy(3, 7)); //---- labelChannel ---- labelChannel.setText("\u041a\u0430\u043d\u0430\u043b:"); add(labelChannel, CC.xy(1, 9)); add(chooserChannel, CC.xy(3, 9)); //---- buttonClearPlan ---- buttonClearPlan.setText("X"); buttonClearPlan.setToolTipText( "\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u0438 \u043f\u043b\u0430\u043d \u0435\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0443"); buttonClearPlan.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { buttonClearPlanActionPerformed(e); } }); add(buttonClearPlan, CC.xy(5, 9)); //---- labelErrors ---- labelErrors.setText("\u041f\u043e\u043c\u0438\u043b\u043a\u0438:"); add(labelErrors, CC.xy(1, 11)); add(chooserErrors, CC.xy(3, 11)); //---- labelLineWidth ---- labelLineWidth.setText("\u0422\u043e\u0432\u0449\u0438\u043d\u0430 \u043b\u0456\u043d\u0456\u0457:"); add(labelLineWidth, CC.xy(1, 13)); //---- spinnerLineWidth ---- spinnerLineWidth.setModel(new SpinnerNumberModel(2, 1, 5, 1)); add(spinnerLineWidth, CC.xy(3, 13)); //---- buttonRemoveFromPlan ---- buttonRemoveFromPlan.setText("\u2190"); buttonRemoveFromPlan.setToolTipText( "\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0437 \u043f\u043b\u0430\u043d\u0443 \u0435\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0443"); buttonRemoveFromPlan.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { buttonRemoveFromPlanActionPerformed(e); } }); add(buttonRemoveFromPlan, CC.xywh(5, 11, 1, 5)); //---- labelLineColor ---- labelLineColor.setText("\u041a\u043e\u043b\u0456\u0440 \u043b\u0456\u043d\u0456\u0457:"); add(labelLineColor, CC.xy(1, 15)); add(chooserLineColor, CC.xy(3, 15)); //---- labelHSquare ---- labelHSquare.setText("h\u00b2="); add(labelHSquare, CC.xy(1, 17)); //---- spinnerHSquareLow ---- spinnerHSquareLow.setModel(new SpinnerNumberModel(0.0, null, null, 1.0)); add(spinnerHSquareLow, CC.xy(3, 17)); //---- labelEllipsis ---- labelEllipsis.setText("\u2026"); add(labelEllipsis, CC.xy(5, 17, CC.CENTER, CC.DEFAULT)); //---- spinnerHSquareHigh ---- spinnerHSquareHigh.setModel(new SpinnerNumberModel(15.0, null, null, 1.0)); add(spinnerHSquareHigh, CC.xy(7, 17)); //======== panelInner1 ======== { panelInner1.setLayout(new FormLayout("5*(default, $lcgap), default:grow", "default")); //---- labelHSquareStep ---- labelHSquareStep.setText(", \u043a\u0440\u043e\u043a:"); panelInner1.add(labelHSquareStep, CC.xy(1, 1)); //---- spinnerHSquareStep ---- spinnerHSquareStep.setModel(new SpinnerNumberModel(0.5, 0.001, null, 0.1)); panelInner1.add(spinnerHSquareStep, CC.xy(3, 1)); //---- labelMeasurementUnit ---- labelMeasurementUnit.setText(", \u043e\u0434\u0438\u043d\u0438\u0446\u0456:"); panelInner1.add(labelMeasurementUnit, CC.xy(5, 1)); //---- radioButtonMeasurementUnitTimes ---- radioButtonMeasurementUnitTimes.setText("\u0440\u0430\u0437\u0438"); radioButtonMeasurementUnitTimes.setSelected(true); panelInner1.add(radioButtonMeasurementUnitTimes, CC.xy(7, 1, CC.LEFT, CC.DEFAULT)); //---- radioButtonMeasurementUnitdB ---- radioButtonMeasurementUnitdB.setText("\u0434\u0411"); panelInner1.add(radioButtonMeasurementUnitdB, CC.xy(9, 1, CC.LEFT, CC.DEFAULT)); //---- buttonRunSimulation ---- buttonRunSimulation.setText("\u0412\u0438\u043a\u043e\u043d\u0430\u0442\u0438"); buttonRunSimulation.setToolTipText( "\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u044e\u0432\u0430\u043d\u043d\u044f"); buttonRunSimulation.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { buttonRunSimulationActionPerformed(e); } }); panelInner1.add(buttonRunSimulation, CC.xy(11, 1, CC.RIGHT, CC.DEFAULT)); } add(panelInner1, CC.xy(9, 17)); //---- labelIterations ---- labelIterations.setText("\u0406\u0442\u0435\u0440\u0430\u0446\u0456\u0439:"); add(labelIterations, CC.xy(1, 19)); //---- spinnerIterations ---- spinnerIterations.setModel(new SpinnerNumberModel(200000, 1, null, 50000)); add(spinnerIterations, CC.xy(3, 19)); //---- checkBoxShowLineNumbers ---- checkBoxShowLineNumbers.setText( "\u041d\u0443\u043c\u0435\u0440\u0443\u0432\u0430\u0442\u0438 \u0433\u0440\u0430\u0444\u0456\u043a\u0438"); add(checkBoxShowLineNumbers, CC.xywh(7, 19, 3, 1)); //======== tabbedPaneResults ======== { //======== panelChart ======== { panelChart.setLayout(new BoxLayout(panelChart, BoxLayout.X_AXIS)); } tabbedPaneResults.addTab("\u0413\u0440\u0430\u0444\u0456\u043a\u0438", panelChart); //======== panelNumeric ======== { panelNumeric.setLayout(new FormLayout("default:grow", "default:grow")); //======== scrollPane2 ======== { //---- textAreaNumeric ---- textAreaNumeric.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); textAreaNumeric.setEditable(false); scrollPane2.setViewportView(textAreaNumeric); } panelNumeric.add(scrollPane2, CC.xy(1, 1, CC.DEFAULT, CC.FILL)); } tabbedPaneResults.addTab("\u0427\u0438\u0441\u043b\u043e\u0432\u0456 \u0434\u0430\u043d\u0456", panelNumeric); } add(tabbedPaneResults, CC.xywh(1, 21, 9, 1, CC.DEFAULT, CC.FILL)); add(progressBar, CC.xywh(1, 23, 9, 1)); //---- buttonGroupMeasurementUnit ---- ButtonGroup buttonGroupMeasurementUnit = new ButtonGroup(); buttonGroupMeasurementUnit.add(radioButtonMeasurementUnitTimes); buttonGroupMeasurementUnit.add(radioButtonMeasurementUnitdB); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:at.becast.youploader.gui.FrmMain.java
public void initQueuetab() { JScrollPane TabQueues = new JScrollPane(); QueuePanel = new JPanel(); TabQueues.setViewportView(QueuePanel); QueuePanel.setLayout(new MigLayout("", "[875px,grow,fill]", "[][][][]")); JPanel buttonPanel = new JPanel(); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.fill = GridBagConstraints.BOTH; gbc_panel_2.gridx = 0;//from w ww . j a v a 2 s . c o m gbc_panel_2.gridy = 1; buttonPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(39dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(92dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(46dlu;min)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(22dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("max(0dlu;default)"), })); JButton btnStart = new JButton(LANG.getString("frmMain.start")); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startUploads(); } }); JLabel lblAfterUploadsFinish = new JLabel(LANG.getString("frmMain.afterfinish")); buttonPanel.add(lblAfterUploadsFinish, "10, 2, 7, 1"); buttonPanel.add(btnStart, "2, 4"); JButton btnStop = new JButton(LANG.getString("frmMain.stop")); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { UploadMgr.stop(); } }); buttonPanel.add(btnStop, "6, 4"); cmbAfterFinish = new JComboBox<Object>(); cmbAfterFinish.setModel(new DefaultComboBoxModel<Object>(new String[] { LANG.getString("frmMain.afterfinish.donothing"), LANG.getString("frmMain.afterfinish.suspend"), LANG.getString("frmMain.afterfinish.shutdown") })); buttonPanel.add(cmbAfterFinish, "10, 4, 7, 1, fill, default"); JLabel lblUploads = new JLabel(LANG.getString("frmMain.uploads") + ":"); buttonPanel.add(lblUploads, "18, 4, right, fill"); JSlider slider = new JSlider(); slider.setPaintTicks(true); slider.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { JSlider s = (JSlider) evt.getSource(); UploadMgr.setUploadlimit(s.getValue()); } }); slider.setMajorTickSpacing(1); slider.setMinorTickSpacing(1); slider.setMinimum(1); slider.setMaximum(5); slider.setValue(1); slider.setSnapToTicks(true); slider.setPaintLabels(true); buttonPanel.add(slider, "20, 4, fill, fill"); JLabel lblUploadSpeed = new JLabel(LANG.getString("frmMain.uploadspeed") + ":"); lblUploadSpeed.setHorizontalAlignment(SwingConstants.TRAILING); buttonPanel.add(lblUploadSpeed, "24, 4"); spinner = new JSpinner(); spinner.setModel(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(10))); spinner.setEditor(new SpeedValuesSpinnerEditor(spinner)); spinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner s = (JSpinner) e.getSource(); speed = Integer.parseInt(s.getValue().toString()); Main.s.put("speed", String.valueOf(speed)); UploadMgr.setLimit(speed); } }); spinner.setValue(speed); buttonPanel.add(spinner, "26, 4"); JLabel lblKbps = new JLabel("kbps"); buttonPanel.add(lblKbps, "28, 4"); JPanel TabQueue = new JPanel(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.Queue"), null, TabQueue, null); TabQueue.setLayout(new BorderLayout(0, 0)); TabQueue.add(buttonPanel, BorderLayout.SOUTH); TabQueue.add(TabQueues, BorderLayout.CENTER); }
From source file:com.alvermont.terraj.fracplanet.ui.ControlsDialog.java
/** This method is called from within the constructor to * initialize the form.//w ww. j a va2 s.co m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { terrainButtonGroup = new javax.swing.ButtonGroup(); regenTerrainButton = new javax.swing.JButton(); regenRiverButton = new javax.swing.JButton(); regenButton = new javax.swing.JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jTabbedPane2 = new javax.swing.JTabbedPane(); basicPanel = new javax.swing.JPanel(); terrainTypeCombo = new javax.swing.JComboBox<String>(); jLabel1 = new javax.swing.JLabel(); baseHeightSpinner = new javax.swing.JSpinner(); terrainSeedSpinner = new javax.swing.JSpinner(); powerLawSpinner = new javax.swing.JSpinner(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); subdivPanel = new javax.swing.JPanel(); subdivisionSpinner = new javax.swing.JSpinner(); unperturbedSpinner = new javax.swing.JSpinner(); vertPeturbSpinner = new javax.swing.JSpinner(); horizPeturbSpinner = new javax.swing.JSpinner(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); noisePanel = new javax.swing.JPanel(); noiseTermSpinner = new javax.swing.JSpinner(); noiseFrequencySpinner = new javax.swing.JSpinner(); noiseAmplitudeSpinner = new javax.swing.JSpinner(); noiseAmplitudeDecaySpinner = new javax.swing.JSpinner(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jButton3 = new javax.swing.JButton(); snowPanel = new javax.swing.JPanel(); snowEquatorSpinner = new javax.swing.JSpinner(); snowPoleSpinner = new javax.swing.JSpinner(); snowPowerLawSpinner = new javax.swing.JSpinner(); snowSlopeSpinner = new javax.swing.JSpinner(); snowGlacierSpinner = new javax.swing.JSpinner(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jButton4 = new javax.swing.JButton(); riverPanel = new javax.swing.JPanel(); riverSpinner = new javax.swing.JSpinner(); riverSeedSpinner = new javax.swing.JSpinner(); riverLakeSeaSpinner = new javax.swing.JSpinner(); jLabel18 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); jButton5 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); colourResetButton = new javax.swing.JButton(); jLabel21 = new javax.swing.JLabel(); jLabel22 = new javax.swing.JLabel(); jLabel23 = new javax.swing.JLabel(); jLabel24 = new javax.swing.JLabel(); jLabel25 = new javax.swing.JLabel(); jLabel26 = new javax.swing.JLabel(); lowTerrainButton = new javax.swing.JButton(); highTerrainButton = new javax.swing.JButton(); oceanButton = new javax.swing.JButton(); riverButton = new javax.swing.JButton(); shorelineButton = new javax.swing.JButton(); snowButton = new javax.swing.JButton(); saveColoursButton = new javax.swing.JButton(); loadColoursButton = new javax.swing.JButton(); jLabel27 = new javax.swing.JLabel(); oceansEmissiveSpinner = new javax.swing.JSpinner(); jPanel8 = new javax.swing.JPanel(); enableCloudsCheckbox = new javax.swing.JCheckBox(); cloudsSubdivisionsCheckbox = new javax.swing.JCheckBox(); cloudsSubdivisionSpinner = new javax.swing.JSpinner(); jLabel35 = new javax.swing.JLabel(); cloudsSeedSpinner = new javax.swing.JSpinner(); jLabel36 = new javax.swing.JLabel(); cloudButton = new javax.swing.JButton(); resetCloudsButton = new javax.swing.JButton(); jLabel37 = new javax.swing.JLabel(); cloudsHeightSpinner = new javax.swing.JSpinner(); renderPanel = new javax.swing.JPanel(); jTabbedPane3 = new javax.swing.JTabbedPane(); jPanel6 = new javax.swing.JPanel(); jLabel30 = new javax.swing.JLabel(); sunlightButton = new javax.swing.JButton(); sunXSlider = new javax.swing.JSlider(); sunYSlider = new javax.swing.JSlider(); sunZSlider = new javax.swing.JSlider(); jLabel31 = new javax.swing.JLabel(); jLabel32 = new javax.swing.JLabel(); jLabel33 = new javax.swing.JLabel(); resetSunlightButton = new javax.swing.JButton(); jPanel7 = new javax.swing.JPanel(); fogButton = new javax.swing.JButton(); jLabel34 = new javax.swing.JLabel(); ambientSpinner = new javax.swing.JSpinner(); resetAmbientButton = new javax.swing.JButton(); enableFogCheckbox = new javax.swing.JCheckBox(); jLabel29 = new javax.swing.JLabel(); fogDistanceSpinner = new javax.swing.JSpinner(); jPanel4 = new javax.swing.JPanel(); resetRenderButton = new javax.swing.JButton(); wireframeCheckbox = new javax.swing.JCheckBox(); displayListCheckbox = new javax.swing.JCheckBox(); nvidiaHackCheckbox = new javax.swing.JCheckBox(); framesPerSecondSpinner = new javax.swing.JSpinner(); jLabel28 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); exportSeaCheckbox = new javax.swing.JCheckBox(); exportAtmosphereCheckbox = new javax.swing.JCheckBox(); excludeAlternateCheckbox = new javax.swing.JCheckBox(); resetExportButton = new javax.swing.JButton(); jPanel5 = new javax.swing.JPanel(); verticesLabel = new javax.swing.JLabel(); trianglesLabel = new javax.swing.JLabel(); landTriangleLabel = new javax.swing.JLabel(); seaTriangleLabel = new javax.swing.JLabel(); regenCloudsButton = new javax.swing.JButton(); setTitle("Controls"); regenTerrainButton.setAction(new RegenTerrainAction("RegenTerrain")); regenTerrainButton.setText("... with new terrain seed"); regenRiverButton.setAction(new RegenRiversAction("RegenRivers")); regenRiverButton.setText("... with new rivers seed"); regenButton.setAction(new RegenAction("Regenerate")); regenButton.setText("Regenerate"); jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT); jTabbedPane2.addChangeListener(new javax.swing.event.ChangeListener() { @Override public void stateChanged(javax.swing.event.ChangeEvent evt) { jTabbedPane2StateChanged(evt); } }); terrainTypeCombo.setModel(new DefaultComboBoxModel<>( new String[] { "Planet", "Hexagonal Terrain", "Square Terrain", "Triangular Terrain" })); terrainTypeCombo.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { terrainTypeComboActionPerformed(evt); } }); jLabel1.setText("Terrain type"); baseHeightSpinner.setModel(new SpinnerNumberModel(0, -100, 100, 10)); baseHeightSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { baseHeightSpinnerStateChanged(evt); } }); terrainSeedSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { terrainSeedSpinnerStateChanged(evt); } }); powerLawSpinner.setModel(new SpinnerNumberModel(1, 1, 10000, 10)); powerLawSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { powerLawSpinnerStateChanged(evt); } }); jLabel2.setText("Base land height (%)"); jLabel3.setText("Terrain random seed"); jLabel4.setText("Power law"); jButton1.setText("Reset"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout basicPanelLayout = new org.jdesktop.layout.GroupLayout(basicPanel); basicPanel.setLayout(basicPanelLayout); basicPanelLayout.setHorizontalGroup(basicPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(basicPanelLayout.createSequentialGroup().addContainerGap().add(basicPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(basicPanelLayout.createSequentialGroup() .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel1).add(jLabel2).add(jLabel3).add(jLabel4)) .add(76, 76, 76) .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(powerLawSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, terrainSeedSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, baseHeightSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, terrainTypeCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 167, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton1)).addContainerGap())); basicPanelLayout.setVerticalGroup(basicPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(basicPanelLayout.createSequentialGroup().addContainerGap() .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1).add(terrainTypeCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel2).add(baseHeightSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel3).add(terrainSeedSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(basicPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel4).add(powerLawSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 146, Short.MAX_VALUE) .add(jButton1).addContainerGap())); jTabbedPane2.addTab("Basic", basicPanel); subdivisionSpinner.setModel(new SpinnerNumberModel(1, 0, 16, 1)); subdivisionSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { subdivisionSpinnerStateChanged(evt); } }); unperturbedSpinner.setModel(new SpinnerNumberModel(1, 0, 16, 1)); unperturbedSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { unperturbedSpinnerStateChanged(evt); } }); vertPeturbSpinner.setModel(new SpinnerNumberModel(0, 0, 50, 1)); vertPeturbSpinner.addChangeListener(new javax.swing.event.ChangeListener() { @Override public void stateChanged(javax.swing.event.ChangeEvent evt) { vertPeturbSpinnerStateChanged(evt); } }); horizPeturbSpinner.setModel(new SpinnerNumberModel(0, 0, 25, 1)); horizPeturbSpinner.addChangeListener(new javax.swing.event.ChangeListener() { @Override public void stateChanged(javax.swing.event.ChangeEvent evt) { horizPeturbSpinnerStateChanged(evt); } }); jLabel5.setText("Total subdivisions"); jLabel6.setText("Unperturbed subdivisions"); jLabel7.setText("Vertical peturbation"); jLabel8.setText("Horizontal peturbation"); jButton2.setText("Reset"); jButton2.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout subdivPanelLayout = new org.jdesktop.layout.GroupLayout(subdivPanel); subdivPanel.setLayout(subdivPanelLayout); subdivPanelLayout.setHorizontalGroup(subdivPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(subdivPanelLayout.createSequentialGroup().addContainerGap().add(subdivPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(subdivPanelLayout.createSequentialGroup() .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel5).add(jLabel6).add(jLabel7).add(jLabel8)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 118, Short.MAX_VALUE) .add(subdivPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(horizPeturbSpinner).add(vertPeturbSpinner).add(unperturbedSpinner) .add(subdivisionSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton2)).addContainerGap())); subdivPanelLayout.setVerticalGroup(subdivPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(subdivPanelLayout.createSequentialGroup().addContainerGap() .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel5).add(subdivisionSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel6).add(unperturbedSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel7).add(vertPeturbSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(subdivPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel8).add(horizPeturbSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 148, Short.MAX_VALUE) .add(jButton2).addContainerGap())); jTabbedPane2.addTab("Subdivision", subdivPanel); noiseTermSpinner.setModel(new SpinnerNumberModel(0, 0, 10, 1)); noiseTermSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { noiseTermSpinnerStateChanged(evt); } }); noiseFrequencySpinner.setModel(new SpinnerNumberModel(0, 0, 10000, 10)); noiseFrequencySpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { noiseFrequencySpinnerStateChanged(evt); } }); noiseAmplitudeSpinner.setModel(new SpinnerNumberModel(0, 0, 100, 1)); noiseAmplitudeSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { noiseAmplitudeSpinnerStateChanged(evt); } }); noiseAmplitudeDecaySpinner.setModel(new SpinnerNumberModel(0, 0, 100, 10)); noiseAmplitudeDecaySpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { noiseAmplitudeDecaySpinnerStateChanged(evt); } }); jLabel9.setText("Noise terms"); jLabel10.setText("Noise frequency"); jLabel11.setText("Noise amplitude"); jLabel12.setText("Noise amplitude decay"); jButton3.setText("Reset"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout noisePanelLayout = new org.jdesktop.layout.GroupLayout(noisePanel); noisePanel.setLayout(noisePanelLayout); noisePanelLayout.setHorizontalGroup(noisePanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(noisePanelLayout.createSequentialGroup().addContainerGap().add(noisePanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(noisePanelLayout.createSequentialGroup() .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel9).add(jLabel10).add(jLabel11).add(jLabel12)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 125, Short.MAX_VALUE) .add(noisePanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(noiseAmplitudeDecaySpinner).add(noiseAmplitudeSpinner) .add(noiseFrequencySpinner).add(org.jdesktop.layout.GroupLayout.TRAILING, noiseTermSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton3)).addContainerGap())); noisePanelLayout.setVerticalGroup(noisePanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(noisePanelLayout.createSequentialGroup().addContainerGap() .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel9).add(noiseTermSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel10) .add(noiseFrequencySpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel11).add(noiseAmplitudeSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(noisePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel12).add(noiseAmplitudeDecaySpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 148, Short.MAX_VALUE) .add(jButton3).addContainerGap())); jTabbedPane2.addTab("Noise", noisePanel); org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jTabbedPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jTabbedPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)); jTabbedPane1.addTab("Terrain", jPanel1); snowEquatorSpinner.setModel(new SpinnerNumberModel(0, -100, 200, 10)); snowEquatorSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { snowEquatorSpinnerStateChanged(evt); } }); snowPoleSpinner.setModel(new SpinnerNumberModel(0, -100, 200, 10)); snowPoleSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { snowPoleSpinnerStateChanged(evt); } }); snowPowerLawSpinner.setModel(new SpinnerNumberModel(1, 1, 1000, 10)); snowPowerLawSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { snowPowerLawSpinnerStateChanged(evt); } }); snowSlopeSpinner.setModel(new SpinnerNumberModel(0, 0, 10000, 5)); snowSlopeSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { snowSlopeSpinnerStateChanged(evt); } }); snowGlacierSpinner.setModel(new SpinnerNumberModel(0, -1000, 1000, 5)); snowGlacierSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { snowGlacierSpinnerStateChanged(evt); } }); jLabel13.setText("Snowline at equator"); jLabel14.setText("Snowline at pole"); jLabel15.setText("Snowline power law"); jLabel16.setText("Snowline slope suppression"); jLabel17.setText("Snowline glacier effect"); jButton4.setText("Reset"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout snowPanelLayout = new org.jdesktop.layout.GroupLayout(snowPanel); snowPanel.setLayout(snowPanelLayout); snowPanelLayout.setHorizontalGroup(snowPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(snowPanelLayout.createSequentialGroup().addContainerGap().add(snowPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(snowPanelLayout.createSequentialGroup() .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel13).add(jLabel14).add(jLabel15).add(jLabel16).add(jLabel17)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 115, Short.MAX_VALUE) .add(snowPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(snowGlacierSpinner).add(snowSlopeSpinner).add(snowPowerLawSpinner) .add(snowPoleSpinner).add(snowEquatorSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton4)).addContainerGap())); snowPanelLayout.setVerticalGroup(snowPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(snowPanelLayout.createSequentialGroup().addContainerGap() .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel13).add(snowEquatorSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel14).add(snowPoleSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel15).add(snowPowerLawSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel16).add(snowSlopeSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(snowPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel17).add(snowGlacierSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 147, Short.MAX_VALUE) .add(jButton4).addContainerGap())); jTabbedPane1.addTab("Snow", snowPanel); riverSpinner.setModel(new SpinnerNumberModel(0, 0, 1000000, 100)); riverSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { riverSpinnerStateChanged(evt); } }); riverSeedSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { riverSeedSpinnerStateChanged(evt); } }); riverLakeSeaSpinner.setModel(new SpinnerNumberModel(1, 1, 100, 1)); riverLakeSeaSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { riverLakeSeaSpinnerStateChanged(evt); } }); jLabel18.setText("Number of rivers"); jLabel19.setText("River random seed"); jLabel20.setText("Lake becomes sea"); jButton5.setText("Reset"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout riverPanelLayout = new org.jdesktop.layout.GroupLayout(riverPanel); riverPanel.setLayout(riverPanelLayout); riverPanelLayout.setHorizontalGroup(riverPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(riverPanelLayout.createSequentialGroup().addContainerGap().add(riverPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(riverPanelLayout.createSequentialGroup() .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel18).add(jLabel19).add(jLabel20)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 155, Short.MAX_VALUE) .add(riverPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(riverLakeSeaSpinner).add(riverSeedSpinner).add(riverSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton5)).addContainerGap())); riverPanelLayout.setVerticalGroup(riverPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(riverPanelLayout.createSequentialGroup().addContainerGap() .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel18).add(riverSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel19).add(riverSeedSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(riverPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel20).add(riverLakeSeaSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 199, Short.MAX_VALUE) .add(jButton5).addContainerGap())); jTabbedPane1.addTab("Rivers", riverPanel); colourResetButton.setText("Reset"); colourResetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { colourResetButtonActionPerformed(evt); } }); jLabel21.setText("Colour of low terrain"); jLabel22.setText("Colour of high terrain"); jLabel23.setText("Colour of ocean"); jLabel24.setText("Colour of rivers"); jLabel25.setText("Colour of shoreline"); jLabel26.setText("Colour of snow"); lowTerrainButton.setText("Select ..."); lowTerrainButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { lowTerrainButtonActionPerformed(evt); } }); highTerrainButton.setText("Select ..."); highTerrainButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { highTerrainButtonActionPerformed(evt); } }); oceanButton.setText("Select ..."); oceanButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { oceanButtonActionPerformed(evt); } }); riverButton.setText("Select ..."); riverButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { riverButtonActionPerformed(evt); } }); shorelineButton.setText("Select ..."); shorelineButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { shorelineButtonActionPerformed(evt); } }); snowButton.setText("Select ..."); snowButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { snowButtonActionPerformed(evt); } }); saveColoursButton.setText("Save ..."); saveColoursButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveColoursButtonActionPerformed(evt); } }); loadColoursButton.setText("Load ..."); loadColoursButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadColoursButtonActionPerformed(evt); } }); jLabel27.setText("Oceans and rivers emissive"); oceansEmissiveSpinner.setModel(new SpinnerNumberModel(0, 0, 100, 5)); oceansEmissiveSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { oceansEmissiveSpinnerStateChanged(evt); } }); org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup().addContainerGap().add(jPanel2Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel26).add(jLabel24) .add(jLabel22).add(jLabel21).add(jLabel25).add(jLabel23) .add(jPanel2Layout.createSequentialGroup().add(saveColoursButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(loadColoursButton)) .add(jLabel27)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 34, Short.MAX_VALUE) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(org.jdesktop.layout.GroupLayout.TRAILING, snowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, riverButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, oceanButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, highTerrainButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(lowTerrainButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, shorelineButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, oceansEmissiveSpinner) .add(colourResetButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(lowTerrainButton).add(jLabel21)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(highTerrainButton).add(jLabel22)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(oceanButton).add(jLabel23)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(riverButton).add(jLabel24)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(shorelineButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(snowButton).add(jLabel26)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel27).add(oceansEmissiveSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 77, Short.MAX_VALUE) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(colourResetButton) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(saveColoursButton).add(loadColoursButton))) .addContainerGap())); jTabbedPane1.addTab("Colours", jPanel2); enableCloudsCheckbox.setText("Enable clouds"); enableCloudsCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); enableCloudsCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); enableCloudsCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { enableCloudsCheckboxStateChanged(evt); } }); cloudsSubdivisionsCheckbox.setText("Use own subdivisions"); cloudsSubdivisionsCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); cloudsSubdivisionsCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); cloudsSubdivisionsCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cloudsSubdivisionsCheckboxActionPerformed(evt); } }); cloudsSubdivisionsCheckbox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { cloudsSubdivisionsCheckboxStateChanged(evt); } }); cloudsSubdivisionSpinner.setModel(new SpinnerNumberModel(1, 0, 16, 1)); cloudsSubdivisionSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { cloudsSubdivisionSpinnerStateChanged(evt); } }); jLabel35.setText("Clouds random seed"); cloudsSeedSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { cloudsSeedSpinnerStateChanged(evt); } }); jLabel36.setText("Cloud colour"); cloudButton.setText("Select ..."); cloudButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cloudButtonActionPerformed(evt); } }); resetCloudsButton.setText("Reset"); resetCloudsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetCloudsButtonActionPerformed(evt); } }); jLabel37.setText("Cloud height"); cloudsHeightSpinner.setModel(new SpinnerNumberModel(1, 1, 100, 1)); cloudsHeightSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { cloudsHeightSpinnerStateChanged(evt); } }); org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel8Layout.createSequentialGroup().addContainerGap() .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(enableCloudsCheckbox) .add(org.jdesktop.layout.GroupLayout.TRAILING, resetCloudsButton) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup().add(jLabel36).add(123, 123, 123).add( cloudButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout .createSequentialGroup() .add(jPanel8Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel35).add(cloudsSubdivisionsCheckbox).add(jLabel37)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 63, Short.MAX_VALUE) .add(jPanel8Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(cloudsHeightSpinner).add(cloudsSubdivisionSpinner) .add(cloudsSeedSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)))) .addContainerGap())); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel8Layout.createSequentialGroup().addContainerGap().add(enableCloudsCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(cloudsSubdivisionsCheckbox).add(cloudsSubdivisionSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(cloudsSeedSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel35)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(cloudsHeightSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabel37)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(cloudButton).add(jLabel36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 149, Short.MAX_VALUE) .add(resetCloudsButton).addContainerGap())); jTabbedPane1.addTab("Clouds", jPanel8); jLabel30.setText("Sunlight colour setting"); sunlightButton.setText("Select ..."); sunlightButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sunlightButtonActionPerformed(evt); } }); sunXSlider.setMajorTickSpacing(50); sunXSlider.setMinimum(-100); sunXSlider.setMinorTickSpacing(25); sunXSlider.setPaintLabels(true); sunXSlider.setPaintTicks(true); sunXSlider.setValue(0); sunXSlider.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sunXSliderStateChanged(evt); } }); sunYSlider.setMajorTickSpacing(50); sunYSlider.setMinimum(-100); sunYSlider.setMinorTickSpacing(25); sunYSlider.setPaintLabels(true); sunYSlider.setPaintTicks(true); sunYSlider.setValue(0); sunYSlider.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sunYSliderStateChanged(evt); } }); sunZSlider.setMajorTickSpacing(50); sunZSlider.setMinimum(-100); sunZSlider.setMinorTickSpacing(25); sunZSlider.setPaintLabels(true); sunZSlider.setPaintTicks(true); sunZSlider.setValue(0); sunZSlider.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sunZSliderStateChanged(evt); } }); jLabel31.setLabelFor(sunXSlider); jLabel31.setText("Sun X Location"); jLabel32.setText("Sun Y Location"); jLabel33.setText("Sun Z Location"); resetSunlightButton.setText("Reset"); resetSunlightButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetSunlightButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel6Layout.createSequentialGroup().addContainerGap() .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, resetSunlightButton) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel6Layout.createSequentialGroup().add(jLabel30) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 75, Short.MAX_VALUE) .add(sunlightButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 163, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jPanel6Layout.createSequentialGroup() .add(jPanel6Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel32).add(jLabel33).add(jLabel31)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel6Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(sunXSlider, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, sunZSlider, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE) .add(sunYSlider, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)))) .addContainerGap())); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel6Layout.createSequentialGroup().addContainerGap() .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(sunlightButton).add(jLabel30)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel31).add(sunXSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel32).add(sunYSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel33).add(sunZSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 67, Short.MAX_VALUE) .add(resetSunlightButton).addContainerGap())); jTabbedPane3.addTab("Sun", jPanel6); fogButton.setText("Select ..."); fogButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fogButtonActionPerformed(evt); } }); jLabel34.setText("Ambient light intensity"); ambientSpinner.setModel(new SpinnerNumberModel(1.0, 0.0, 1.0, 0.001)); ambientSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { ambientSpinnerStateChanged(evt); } }); resetAmbientButton.setText("Reset"); resetAmbientButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetAmbientButtonActionPerformed(evt); } }); enableFogCheckbox.setText("Enable fog"); enableFogCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); enableFogCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); enableFogCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { enableFogCheckboxActionPerformed(evt); } }); jLabel29.setText("Fog distance"); fogDistanceSpinner.setModel(new SpinnerNumberModel(0, 0, 1000, 1)); fogDistanceSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { fogDistanceSpinnerStateChanged(evt); } }); org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel7Layout.createSequentialGroup().addContainerGap().add(jPanel7Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, resetAmbientButton) .add(jPanel7Layout.createSequentialGroup() .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(enableFogCheckbox).add(jLabel34).add(jLabel29)) .add(25, 25, 25) .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fogDistanceSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE) .add(ambientSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE) .add(fogButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE)))) .addContainerGap())); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel7Layout.createSequentialGroup().addContainerGap() .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel34).add(ambientSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(fogButton).add(enableFogCheckbox)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel29).add(fogDistanceSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 171, Short.MAX_VALUE) .add(resetAmbientButton).addContainerGap())); jTabbedPane3.addTab("Ambient", jPanel7); resetRenderButton.setText("Reset"); resetRenderButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetRenderButtonActionPerformed(evt); } }); wireframeCheckbox.setText("Wireframe rendering only"); wireframeCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); wireframeCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); wireframeCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { wireframeCheckboxActionPerformed(evt); } }); displayListCheckbox.setText("Use an OpenGL display list for rendering"); displayListCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); displayListCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); displayListCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { displayListCheckboxActionPerformed(evt); } }); nvidiaHackCheckbox.setText("Disable glDeleteList() for Linux / NVIDIA issue"); nvidiaHackCheckbox.setToolTipText("Turning this off Linux with nvidia GL may crash the program"); nvidiaHackCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); nvidiaHackCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); nvidiaHackCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nvidiaHackCheckboxActionPerformed(evt); } }); framesPerSecondSpinner.setModel(new SpinnerNumberModel(50, 1, 100, 1)); framesPerSecondSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { framesPerSecondSpinnerStateChanged(evt); } }); jLabel28.setText("Target frames per second"); org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(wireframeCheckbox) .addContainerGap(215, Short.MAX_VALUE)) .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(displayListCheckbox) .addContainerGap(145, Short.MAX_VALUE)) .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(nvidiaHackCheckbox) .addContainerGap(119, Short.MAX_VALUE)) .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(jLabel28) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(framesPerSecondSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 82, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(144, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup() .addContainerGap(291, Short.MAX_VALUE).add(resetRenderButton).addContainerGap())); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel4Layout.createSequentialGroup().addContainerGap().add(wireframeCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(displayListCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(nvidiaHackCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel28).add(framesPerSecondSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(135, 135, 135).add(resetRenderButton).addContainerGap())); jTabbedPane3.addTab("Options", jPanel4); org.jdesktop.layout.GroupLayout renderPanelLayout = new org.jdesktop.layout.GroupLayout(renderPanel); renderPanel.setLayout(renderPanelLayout); renderPanelLayout .setHorizontalGroup(renderPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jTabbedPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE)); renderPanelLayout .setVerticalGroup(renderPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jTabbedPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)); jTabbedPane1.addTab("Render", null, renderPanel, "Options affecting rendering"); exportSeaCheckbox.setText("Export sea as object rather than triangles"); exportSeaCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); exportSeaCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); exportSeaCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exportSeaCheckboxActionPerformed(evt); } }); exportAtmosphereCheckbox.setText("Output an atmosphere object"); exportAtmosphereCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); exportAtmosphereCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); exportAtmosphereCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exportAtmosphereCheckboxActionPerformed(evt); } }); excludeAlternateCheckbox.setText("Exclude alternate colour triangles"); excludeAlternateCheckbox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); excludeAlternateCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0)); excludeAlternateCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { excludeAlternateCheckboxActionPerformed(evt); } }); resetExportButton.setText("Reset"); resetExportButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetExportButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(exportSeaCheckbox).add(exportAtmosphereCheckbox).add(excludeAlternateCheckbox)) .addContainerGap(140, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap(296, Short.MAX_VALUE).add(resetExportButton).addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap().add(exportSeaCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(exportAtmosphereCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(excludeAlternateCheckbox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 214, Short.MAX_VALUE) .add(resetExportButton).addContainerGap())); jTabbedPane1.addTab("Export", jPanel3); verticesLabel.setText("jLabel29"); trianglesLabel.setText("jLabel30"); landTriangleLabel.setText("jLabel29"); seaTriangleLabel.setText("jLabel30"); org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5Layout.createSequentialGroup().addContainerGap() .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(verticesLabel).add(trianglesLabel).add(landTriangleLabel) .add(seaTriangleLabel)) .addContainerGap(319, Short.MAX_VALUE))); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5Layout.createSequentialGroup().addContainerGap().add(verticesLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(trianglesLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(landTriangleLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(seaTriangleLabel) .addContainerGap(231, Short.MAX_VALUE))); jTabbedPane1.addTab("Stats", jPanel5); regenCloudsButton.setAction(new RegenCloudsAction("RegenClouds")); regenCloudsButton.setText("... with new clouds seed"); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(regenRiverButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE) .add(regenButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE) .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE) .add(regenTerrainButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE) .add(regenCloudsButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenRiverButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenTerrainButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(regenCloudsButton))); pack(); }
From source file:com.github.lindenb.jvarkit.tools.bamviewgui.BamFileRef.java
BamFrame(List<BamFileRef> BamFileRefs) { super((JFrame) null, "Bam View (" + BamFileRefs.size() + " files)", ModalityType.APPLICATION_MODAL); this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); this.BamFileRefs = BamFileRefs; addWindowListener(new WindowAdapter() { @Override// ww w. ja va 2 s .c o m public void windowOpened(WindowEvent e) { removeWindowListener(this); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); d.width -= 150; d.height -= 150; for (BamFileRef vfr : BamFrame.this.BamFileRefs) { LOG.info("Reading " + vfr.bamFile); int w = (int) (d.width * 0.8); int h = (int) (d.height * 0.8); BamInternalFrame iFrame = new BamInternalFrame(vfr); iFrame.setBounds(Math.max((int) ((d.width - w) * Math.random()), 0), Math.max((int) ((d.height - h) * Math.random()), 0), w, h); desktopPane.add(iFrame); BamInternalFrames.add(iFrame); iFrame.setVisible(true); iFrame.jTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { JTable t = (JTable) e.getSource(); int row = t.getSelectedRow(); if (row == -1) return; BamTableModel tm = (BamTableModel) t.getModel(); showIgv(tm.getValueAt(row, 0), tm.getValueAt(row, 1)); } } }); } reloadFrameContent(); } }); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { doMenuClose(); } }); JMenuBar bar = new JMenuBar(); setJMenuBar(bar); JMenu menu = new JMenu("File"); bar.add(menu); menu.add(new AbstractAction("Quit") { @Override public void actionPerformed(ActionEvent e) { doMenuClose(); } }); menu = new JMenu("Flags"); bar.add(menu); for (SamFlag flag : SamFlag.values()) { JCheckBox cbox = new JCheckBox("Require " + flag); requiredFlags.add(cbox); menu.add(cbox); } menu.add(new JSeparator()); for (SamFlag flag : SamFlag.values()) { JCheckBox cbox = new JCheckBox("Filter out " + flag); filteringFlags.add(cbox); menu.add(cbox); } JPanel contentPane = new JPanel(new BorderLayout(5, 5)); setContentPane(contentPane); this.desktopPane = new JDesktopPane(); contentPane.add(this.desktopPane, BorderLayout.CENTER); JPanel top = new JPanel(new FlowLayout(FlowLayout.LEADING)); contentPane.add(top, BorderLayout.NORTH); JLabel lbl = new JLabel("Max Rows:", JLabel.LEADING); JSpinner spinner = new JSpinner(this.numFetchModel = new SpinnerNumberModel(100, 1, 10000, 10)); lbl.setLabelFor(spinner); top.add(lbl); top.add(spinner); lbl = new JLabel("Timeout (secs):", JLabel.LEADING); spinner = new JSpinner(this.numSecondsModel = new SpinnerNumberModel(2, 1, 10000, 1)); lbl.setLabelFor(spinner); top.add(lbl); top.add(spinner); //lbl=new JLabel("JEXL:",JLabel.LEADING); /*jexlField=new JTextField(20); lbl.setLabelFor(jexlField); top.add(lbl); top.add(jexlField);*/ lbl = new JLabel("Region:", JLabel.LEADING); selectRgnField = new JTextField(20); lbl.setLabelFor(selectRgnField); AbstractAction action = new AbstractAction("Select") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent a) { if ( /* (jexlField.getText().trim().isEmpty() || parseJex(jexlField.getText().trim())!=null) && */ (selectRgnField.getText().trim().isEmpty() || parseOne(selectRgnField.getText()) != null)) { reloadFrameContent(); } else { LOG.info("Bad input " + selectRgnField.getText()); } } }; selectRgnField.addActionListener(action); //jexlField.addActionListener(action); top.add(lbl); top.add(selectRgnField); top.add(new JButton(action)); }
From source file:Forms.FrmPrincipal.java
private void init() { pnlCapas.setLayout(new FlowLayout()); SpinnerNumberModel model = new SpinnerNumberModel(0.01, 0.01, 100, 0.01); spFactor.setModel(model);/* ww w. j ava2 s . c o m*/ //this.spFactor.setEditor( new javax.swing.JSpinner.NumberEditor(spFactor, "0.00")); }
From source file:org.adamkrajcik.gui.MainForm.java
private void createWineMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createWineMenuItemActionPerformed JTextField name = new JTextField(); SpinnerNumberModel model = new SpinnerNumberModel((short) Calendar.getInstance().get(Calendar.YEAR), (short) 1700, (short) Calendar.getInstance().get(Calendar.YEAR), (short) 1); JSpinner vintage = new JSpinner(model); SpinnerNumberModel model2 = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1); JSpinner quantity = new JSpinner(model2); String[] wineTypes = { "RED", "WHITE", "ROSE" }; JComboBox type = new JComboBox(wineTypes); List<String> myList = new ArrayList<String>(); for (String countryCode : Locale.getISOCountries()) { Locale obj = new Locale("", countryCode); myList.add(obj.getDisplayCountry(Locale.ENGLISH)); }/*ww w . j av a 2 s. c o m*/ String[] x = new String[myList.size()]; myList.toArray(x); JComboBox countryList = new JComboBox(x); Object[] message = { "Name:", name, "Country:", countryList, "Vintage:", vintage, "Quantity", quantity, "Type", type, }; int option = JOptionPane.showConfirmDialog(null, message, "New Wine", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (option == JOptionPane.OK_OPTION) { if (name.getText().length() == 0) { JOptionPane.showConfirmDialog(null, langResource.getString("errorName"), langResource.getString("errorName"), JOptionPane.PLAIN_MESSAGE, JOptionPane.ERROR_MESSAGE); createWineMenuItemActionPerformed(null); return; } new CreateWineSwingWorker(newWine(name.getText(), (String) countryList.getSelectedItem(), (short) ((int) vintage.getValue()), (int) quantity.getValue(), WineType.valueOf((String) type.getSelectedItem()))).execute(); } }
From source file:de.bfs.radon.omsimulation.gui.OMPanelTesting.java
/** * Initialises the interface of the results panel. *//*from www .j a va2 s .c o m*/ protected void initialize() { setLayout(null); isSimulated = false; lblExportChartTo = new JLabel("Export chart to ..."); lblExportChartTo.setBounds(436, 479, 144, 14); lblExportChartTo.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); lblExportChartTo.setVisible(false); add(lblExportChartTo); btnCsv = new JButton("CSV"); btnCsv.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fileDialog = new JFileChooser(); fileDialog.setFileFilter(new FileNameExtensionFilter("*.csv", "csv")); fileDialog.showSaveDialog(getParent()); final File file = fileDialog.getSelectedFile(); if (file != null) { String csv; String[] tmpFileName = file.getAbsolutePath().split("\\."); if (tmpFileName[tmpFileName.length - 1].equals("csv")) { csv = ""; } else { csv = ".csv"; } String csvPath = file.getAbsolutePath() + csv; double[] selectedValues; OMRoom[] rooms = new OMRoom[7]; rooms[0] = (OMRoom) comboBoxRoom1.getSelectedItem(); rooms[1] = (OMRoom) comboBoxRoom2.getSelectedItem(); rooms[2] = (OMRoom) comboBoxRoom3.getSelectedItem(); rooms[3] = (OMRoom) comboBoxRoom4.getSelectedItem(); rooms[4] = (OMRoom) comboBoxRoom5.getSelectedItem(); rooms[5] = (OMRoom) comboBoxRoom6.getSelectedItem(); rooms[6] = (OMRoom) comboBoxRoom7.getSelectedItem(); int start = sliderStartTime.getValue(); final int day = 24; File csvFile = new File(csvPath); try { OMCampaign campaign; if (isResult) { campaign = getResultCampaign(); } else { campaign = new OMCampaign(start, rooms, 0); } FileWriter logWriter = new FileWriter(csvFile); BufferedWriter csvOutput = new BufferedWriter(logWriter); csvOutput.write("\"ID\";\"Room\";\"Radon\""); csvOutput.newLine(); selectedValues = campaign.getValueChain(); int x = 0; for (int i = start; i < start + day; i++) { csvOutput.write("\"" + i + "\";\"" + rooms[0].getId() + "\";\"" + (int) selectedValues[x] + "\""); csvOutput.newLine(); x++; } start = start + day; for (int i = start; i < start + day; i++) { csvOutput.write("\"" + i + "\";\"" + rooms[1].getId() + "\";\"" + (int) selectedValues[x] + "\""); csvOutput.newLine(); x++; } start = start + day; for (int i = start; i < start + day; i++) { csvOutput.write("\"" + i + "\";\"" + rooms[2].getId() + "\";\"" + (int) selectedValues[x] + "\""); csvOutput.newLine(); x++; } start = start + day; for (int i = start; i < start + day; i++) { csvOutput.write("\"" + i + "\";\"" + rooms[3].getId() + "\";\"" + (int) selectedValues[x] + "\""); csvOutput.newLine(); x++; } start = start + day; for (int i = start; i < start + day; i++) { csvOutput.write("\"" + i + "\";\"" + rooms[4].getId() + "\";\"" + (int) selectedValues[x] + "\""); csvOutput.newLine(); x++; } start = start + day; for (int i = start; i < start + day; i++) { csvOutput.write("\"" + i + "\";\"" + rooms[5].getId() + "\";\"" + (int) selectedValues[x] + "\""); csvOutput.newLine(); x++; } start = start + day; for (int i = start; i < start + day; i++) { csvOutput.write("\"" + i + "\";\"" + rooms[6].getId() + "\";\"" + (int) selectedValues[x] + "\""); csvOutput.newLine(); x++; } JOptionPane.showMessageDialog(null, "CSV saved successfully!\n" + csvPath, "Success", JOptionPane.INFORMATION_MESSAGE); csvOutput.close(); } catch (IOException ioe) { JOptionPane.showMessageDialog(null, "Failed to write CSV. Please check permissions!\n" + ioe.getMessage(), "Failed", JOptionPane.ERROR_MESSAGE); ioe.printStackTrace(); } } else { JOptionPane.showMessageDialog(null, "Failed to write CSV. Please check the file path!", "Failed", JOptionPane.ERROR_MESSAGE); } } }); btnCsv.setBounds(590, 475, 70, 23); btnCsv.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); btnCsv.setVisible(false); add(btnCsv); btnPdf = new JButton("PDF"); btnPdf.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fileDialog = new JFileChooser(); fileDialog.setFileFilter(new FileNameExtensionFilter("*.pdf", "pdf")); fileDialog.showSaveDialog(getParent()); final File file = fileDialog.getSelectedFile(); if (file != null) { String pdf; String[] tmpFileName = file.getAbsolutePath().split("\\."); if (tmpFileName[tmpFileName.length - 1].equals("pdf")) { pdf = ""; } else { pdf = ".pdf"; } String pdfPath = file.getAbsolutePath() + pdf; OMRoom[] rooms = new OMRoom[7]; rooms[0] = (OMRoom) comboBoxRoom1.getSelectedItem(); rooms[1] = (OMRoom) comboBoxRoom2.getSelectedItem(); rooms[2] = (OMRoom) comboBoxRoom3.getSelectedItem(); rooms[3] = (OMRoom) comboBoxRoom4.getSelectedItem(); rooms[4] = (OMRoom) comboBoxRoom5.getSelectedItem(); rooms[5] = (OMRoom) comboBoxRoom6.getSelectedItem(); rooms[6] = (OMRoom) comboBoxRoom7.getSelectedItem(); int start = sliderStartTime.getValue(); OMCampaign campaign; try { if (isResult) { campaign = getResultCampaign(); } else { campaign = new OMCampaign(start, rooms, 0); } JFreeChart chart = OMCharts.createCampaignChart(campaign, false); String title = "Campaign: " + rooms[0].getId() + rooms[1].getId() + rooms[2].getId() + rooms[3].getId() + rooms[4].getId() + rooms[5].getId() + rooms[6].getId() + ", Start: " + start; int height = (int) PageSize.A4.getWidth(); int width = (int) PageSize.A4.getHeight(); try { OMExports.exportPdf(pdfPath, chart, width, height, new DefaultFontMapper(), title); JOptionPane.showMessageDialog(null, "PDF saved successfully!\n" + pdfPath, "Success", JOptionPane.INFORMATION_MESSAGE); } catch (IOException ioe) { JOptionPane.showMessageDialog(null, "Failed to write PDF. Please check permissions!\n" + ioe.getMessage(), "Failed", JOptionPane.ERROR_MESSAGE); ioe.printStackTrace(); } } catch (IOException ioe) { JOptionPane.showMessageDialog(null, "Failed to create chart!\n" + ioe.getMessage(), "Failed", JOptionPane.ERROR_MESSAGE); ioe.printStackTrace(); } } else { JOptionPane.showMessageDialog(null, "Failed to write PDF. Please check the file path!", "Failed", JOptionPane.ERROR_MESSAGE); } } }); btnPdf.setBounds(670, 475, 70, 23); btnPdf.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); btnPdf.setVisible(false); add(btnPdf); lblSelectProject = new JLabel("Select Project"); lblSelectProject.setBounds(10, 65, 132, 14); lblSelectProject.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(lblSelectProject); lblSelectRooms = new JLabel("Select Rooms"); lblSelectRooms.setBounds(10, 94, 132, 14); lblSelectRooms.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(lblSelectRooms); lblStartTime = new JLabel("Start Time"); lblStartTime.setBounds(10, 123, 132, 14); lblStartTime.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(lblStartTime); lblWarning = new JLabel("Select 6 rooms and 1 cellar!"); lblWarning.setForeground(Color.RED); lblWarning.setBounds(565, 123, 175, 14); lblWarning.setFont(new Font("SansSerif", Font.PLAIN, 11)); lblWarning.setVisible(false); add(lblWarning); sliderStartTime = new JSlider(); sliderStartTime.setMaximum(0); sliderStartTime.setBounds(152, 119, 285, 24); sliderStartTime.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(sliderStartTime); spnrStartTime = new JSpinner(); spnrStartTime.setModel(new SpinnerNumberModel(0, 0, 0, 1)); spnrStartTime.setBounds(447, 120, 108, 22); spnrStartTime.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(spnrStartTime); btnRefresh = new JButton("Load"); btnRefresh.setBounds(616, 61, 124, 23); btnRefresh.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(btnRefresh); btnMaximize = new JButton("Fullscreen"); btnMaximize.setBounds(10, 475, 124, 23); btnMaximize.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(btnMaximize); panelCampaign = new JPanel(); panelCampaign.setBounds(10, 150, 730, 315); panelCampaign.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(panelCampaign); progressBar = new JProgressBar(); progressBar.setBounds(10, 475, 730, 23); progressBar.setFont(new Font("SansSerif", Font.PLAIN, 11)); progressBar.setVisible(false); add(progressBar); lblOpenOmbfile = new JLabel("Open OMB-File"); lblOpenOmbfile.setFont(new Font("SansSerif", Font.PLAIN, 11)); lblOpenOmbfile.setBounds(10, 36, 132, 14); add(lblOpenOmbfile); lblHelp = new JLabel("Select an OMB-Object file to manually simulate virtual campaigns."); lblHelp.setForeground(Color.GRAY); lblHelp.setFont(new Font("SansSerif", Font.PLAIN, 11)); lblHelp.setBounds(10, 10, 730, 14); add(lblHelp); txtOmbFile = new JTextField(); txtOmbFile.setFont(new Font("SansSerif", Font.PLAIN, 11)); txtOmbFile.setColumns(10); txtOmbFile.setBounds(152, 33, 454, 20); add(txtOmbFile); btnBrowse = new JButton("Browse"); btnBrowse.setFont(new Font("SansSerif", Font.PLAIN, 11)); btnBrowse.setBounds(616, 32, 124, 23); add(btnBrowse); comboBoxRoom1 = new JComboBox<OMRoom>(); comboBoxRoom1.setBounds(152, 90, 75, 22); comboBoxRoom1.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxRoom1); comboBoxRoom2 = new JComboBox<OMRoom>(); comboBoxRoom2.setBounds(237, 90, 75, 22); comboBoxRoom2.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxRoom2); comboBoxRoom3 = new JComboBox<OMRoom>(); comboBoxRoom3.setBounds(323, 90, 75, 22); comboBoxRoom3.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxRoom3); comboBoxRoom4 = new JComboBox<OMRoom>(); comboBoxRoom4.setBounds(408, 90, 75, 22); comboBoxRoom4.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxRoom4); comboBoxRoom5 = new JComboBox<OMRoom>(); comboBoxRoom5.setBounds(494, 90, 75, 22); comboBoxRoom5.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxRoom5); comboBoxRoom6 = new JComboBox<OMRoom>(); comboBoxRoom6.setBounds(579, 90, 75, 22); comboBoxRoom6.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxRoom6); comboBoxRoom7 = new JComboBox<OMRoom>(); comboBoxRoom7.setBounds(665, 90, 75, 22); comboBoxRoom7.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxRoom7); comboBoxProjects = new JComboBox<OMBuilding>(); comboBoxProjects.setBounds(152, 61, 454, 22); comboBoxProjects.setFont(new Font("SansSerif", Font.PLAIN, 11)); add(comboBoxProjects); comboBoxRoom1.addActionListener(this); comboBoxRoom1.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validateCampaign(); } }); comboBoxRoom2.addActionListener(this); comboBoxRoom2.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validateCampaign(); } }); comboBoxRoom3.addActionListener(this); comboBoxRoom3.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validateCampaign(); } }); comboBoxRoom4.addActionListener(this); comboBoxRoom4.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validateCampaign(); } }); comboBoxRoom5.addActionListener(this); comboBoxRoom5.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validateCampaign(); } }); comboBoxRoom6.addActionListener(this); comboBoxRoom6.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validateCampaign(); } }); comboBoxRoom7.addActionListener(this); comboBoxRoom7.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { validateCampaign(); } }); sliderStartTime.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (comboBoxProjects.isEnabled() || isResult) { if (comboBoxProjects.getSelectedItem() != null) { spnrStartTime.setValue((int) sliderStartTime.getValue()); updateChart(); } } } }); spnrStartTime.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { if (comboBoxProjects.isEnabled() || isResult) { if (comboBoxProjects.getSelectedItem() != null) { sliderStartTime.setValue((Integer) spnrStartTime.getValue()); updateChart(); } } } }); btnRefresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (txtOmbFile.getText() != null && !txtOmbFile.getText().equals("") && !txtOmbFile.getText().equals(" ")) { txtOmbFile.setBackground(Color.WHITE); String ombPath = txtOmbFile.getText(); String omb; String[] tmpFileName = ombPath.split("\\."); if (tmpFileName[tmpFileName.length - 1].equals("omb")) { omb = ""; } else { omb = ".omb"; } txtOmbFile.setText(ombPath + omb); setOmbFile(ombPath + omb); File ombFile = new File(ombPath + omb); if (ombFile.exists()) { txtOmbFile.setBackground(Color.WHITE); btnRefresh.setEnabled(false); comboBoxProjects.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); progressBar.setVisible(true); btnPdf.setVisible(false); btnCsv.setVisible(false); btnMaximize.setVisible(false); lblExportChartTo.setVisible(false); progressBar.setIndeterminate(true); progressBar.setStringPainted(true); refreshTask = new Refresh(); refreshTask.execute(); } else { txtOmbFile.setBackground(new Color(255, 222, 222, 128)); JOptionPane.showMessageDialog(null, "OMB-file not found, please check the file path!", "Error", JOptionPane.ERROR_MESSAGE); } } else { txtOmbFile.setBackground(new Color(255, 222, 222, 128)); JOptionPane.showMessageDialog(null, "Please select an OMB-file!", "Warning", JOptionPane.WARNING_MESSAGE); } } }); btnMaximize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { OMRoom[] rooms = new OMRoom[7]; rooms[0] = (OMRoom) comboBoxRoom1.getSelectedItem(); rooms[1] = (OMRoom) comboBoxRoom2.getSelectedItem(); rooms[2] = (OMRoom) comboBoxRoom3.getSelectedItem(); rooms[3] = (OMRoom) comboBoxRoom4.getSelectedItem(); rooms[4] = (OMRoom) comboBoxRoom5.getSelectedItem(); rooms[5] = (OMRoom) comboBoxRoom6.getSelectedItem(); rooms[6] = (OMRoom) comboBoxRoom7.getSelectedItem(); int start = sliderStartTime.getValue(); String title = "Campaign: " + rooms[0].getId() + rooms[1].getId() + rooms[2].getId() + rooms[3].getId() + rooms[4].getId() + rooms[5].getId() + rooms[6].getId() + ", Start: " + start; OMCampaign campaign; if (isResult) { campaign = getResultCampaign(); } else { campaign = new OMCampaign(start, rooms, 0); } JPanel campaignChart = createCampaignPanel(campaign, false, true); JFrame chartFrame = new JFrame(); chartFrame.getContentPane().add(campaignChart); chartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); chartFrame.setBounds(0, 0, (int) dim.getWidth(), (int) dim.getHeight()); chartFrame.setTitle(title); chartFrame.setResizable(true); chartFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); chartFrame.setVisible(true); } catch (IOException ioe) { ioe.printStackTrace(); } } }); txtOmbFile.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { setOmbFile(txtOmbFile.getText()); } }); btnBrowse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser fileDialog = new JFileChooser(); fileDialog.setFileFilter(new FileNameExtensionFilter("*.omb", "omb")); fileDialog.showOpenDialog(getParent()); final File file = fileDialog.getSelectedFile(); if (file != null) { String omb; String[] tmpFileName = file.getAbsolutePath().split("\\."); if (tmpFileName[tmpFileName.length - 1].equals("omb")) { omb = ""; } else { omb = ".omb"; } txtOmbFile.setText(file.getAbsolutePath() + omb); setOmbFile(file.getAbsolutePath() + omb); } } }); }
From source file:de.bwravencl.controllerbuddy.gui.Main.java
private Main() { Singleton.start(this, SINGLETON_ID); frame = new JFrame(); frame.addWindowListener(new WindowAdapter() { @Override/* w w w.ja va2 s . co m*/ public void windowClosing(final WindowEvent e) { super.windowClosing(e); if (showMenuItem != null) showMenuItem.setEnabled(true); } @Override public void windowDeiconified(final WindowEvent e) { super.windowDeiconified(e); if (showMenuItem != null) showMenuItem.setEnabled(false); } @Override public void windowIconified(final WindowEvent e) { super.windowIconified(e); if (showMenuItem != null) showMenuItem.setEnabled(true); } @Override public void windowOpened(final WindowEvent e) { super.windowOpened(e); if (showMenuItem != null) showMenuItem.setEnabled(false); } }); frame.setBounds(DIALOG_BOUNDS_X, DIALOG_BOUNDS_Y, DIALOG_BOUNDS_WIDTH, DIALOG_BOUNDS_HEIGHT); frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); final var icons = new ArrayList<Image>(); for (final var path : ICON_RESOURCE_PATHS) { final var icon = new ImageIcon(Main.class.getResource(path)); icons.add(icon.getImage()); } frame.setIconImages(icons); frame.setJMenuBar(menuBar); menuBar.add(fileMenu); final QuitAction quitAction = new QuitAction(); fileMenu.add(quitAction); menuBar.add(deviceMenu); if (windows) { menuBar.add(localMenu, 2); final var buttonGroupLocalState = new ButtonGroup(); startLocalRadioButtonMenuItem = new JRadioButtonMenuItem(rb.getString("START_MENU_ITEM")); startLocalRadioButtonMenuItem.setAction(new StartLocalAction()); buttonGroupLocalState.add(startLocalRadioButtonMenuItem); localMenu.add(startLocalRadioButtonMenuItem); stopLocalRadioButtonMenuItem = new JRadioButtonMenuItem(rb.getString("STOP_MENU_ITEM")); stopLocalRadioButtonMenuItem.setAction(new StopLocalAction()); buttonGroupLocalState.add(stopLocalRadioButtonMenuItem); localMenu.add(stopLocalRadioButtonMenuItem); menuBar.add(clientMenu); final var buttonGroupClientState = new ButtonGroup(); startClientRadioButtonMenuItem = new JRadioButtonMenuItem(rb.getString("START_MENU_ITEM")); startClientRadioButtonMenuItem.setAction(new StartClientAction()); buttonGroupClientState.add(startClientRadioButtonMenuItem); clientMenu.add(startClientRadioButtonMenuItem); stopClientRadioButtonMenuItem = new JRadioButtonMenuItem(rb.getString("STOP_MENU_ITEM")); stopClientRadioButtonMenuItem.setAction(new StopClientAction()); buttonGroupClientState.add(stopClientRadioButtonMenuItem); clientMenu.add(stopClientRadioButtonMenuItem); } final var buttonGroupServerState = new ButtonGroup(); startServerRadioButtonMenuItem = new JRadioButtonMenuItem(rb.getString("START_MENU_ITEM")); startServerRadioButtonMenuItem.setAction(new StartServerAction()); buttonGroupServerState.add(startServerRadioButtonMenuItem); serverMenu.add(startServerRadioButtonMenuItem); stopServerRadioButtonMenuItem = new JRadioButtonMenuItem(rb.getString("STOP_MENU_ITEM")); stopServerRadioButtonMenuItem.setAction(new StopServerAction()); buttonGroupServerState.add(stopServerRadioButtonMenuItem); serverMenu.add(stopServerRadioButtonMenuItem); final var helpMenu = new JMenu(rb.getString("HELP_MENU")); menuBar.add(helpMenu); helpMenu.add(new ShowAboutDialogAction()); frame.getContentPane().add(tabbedPane); settingsPanel = new JPanel(); settingsPanel.setLayout(new GridBagLayout()); settingsScrollPane.setViewportView(settingsPanel); tabbedPane.addTab(rb.getString("SETTINGS_TAB"), null, settingsScrollPane); final var panelGridBagConstraints = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 5); final var panelFlowLayout = new FlowLayout(FlowLayout.LEADING, 10, 10); final var pollIntervalPanel = new JPanel(panelFlowLayout); settingsPanel.add(pollIntervalPanel, panelGridBagConstraints); final var pollIntervalLabel = new JLabel(rb.getString("POLL_INTERVAL_LABEL")); pollIntervalLabel.setPreferredSize(new Dimension(120, 15)); pollIntervalPanel.add(pollIntervalLabel); final var pollIntervalSpinner = new JSpinner(new SpinnerNumberModel( preferences.getInt(PREFERENCES_POLL_INTERVAL, OutputThread.DEFAULT_POLL_INTERVAL), 10, 500, 1)); final JSpinner.DefaultEditor pollIntervalSpinnerEditor = new JSpinner.NumberEditor(pollIntervalSpinner, "#"); ((DefaultFormatter) pollIntervalSpinnerEditor.getTextField().getFormatter()).setCommitsOnValidEdit(true); pollIntervalSpinner.setEditor(pollIntervalSpinnerEditor); pollIntervalSpinner.addChangeListener( e -> preferences.putInt(PREFERENCES_POLL_INTERVAL, (int) ((JSpinner) e.getSource()).getValue())); pollIntervalPanel.add(pollIntervalSpinner); if (windows) { final var vJoyDirectoryPanel = new JPanel(panelFlowLayout); settingsPanel.add(vJoyDirectoryPanel, panelGridBagConstraints); final var vJoyDirectoryLabel = new JLabel(rb.getString("VJOY_DIRECTORY_LABEL")); vJoyDirectoryLabel.setPreferredSize(new Dimension(120, 15)); vJoyDirectoryPanel.add(vJoyDirectoryLabel); vJoyDirectoryLabel1 = new JLabel( preferences.get(PREFERENCES_VJOY_DIRECTORY, VJoyOutputThread.getDefaultInstallationPath())); vJoyDirectoryPanel.add(vJoyDirectoryLabel1); final var vJoyDirectoryButton = new JButton(new ChangeVJoyDirectoryAction()); vJoyDirectoryPanel.add(vJoyDirectoryButton); final var vJoyDevicePanel = new JPanel(panelFlowLayout); settingsPanel.add(vJoyDevicePanel, panelGridBagConstraints); final var vJoyDeviceLabel = new JLabel(rb.getString("VJOY_DEVICE_LABEL")); vJoyDeviceLabel.setPreferredSize(new Dimension(120, 15)); vJoyDevicePanel.add(vJoyDeviceLabel); final var vJoyDeviceSpinner = new JSpinner(new SpinnerNumberModel( preferences.getInt(PREFERENCES_VJOY_DEVICE, VJoyOutputThread.DEFAULT_VJOY_DEVICE), 1, 16, 1)); final JSpinner.DefaultEditor vJoyDeviceSpinnerEditor = new JSpinner.NumberEditor(vJoyDeviceSpinner, "#"); ((DefaultFormatter) vJoyDeviceSpinnerEditor.getTextField().getFormatter()).setCommitsOnValidEdit(true); vJoyDeviceSpinner.setEditor(vJoyDeviceSpinnerEditor); vJoyDeviceSpinner.addChangeListener( e -> preferences.putInt(PREFERENCES_VJOY_DEVICE, (int) ((JSpinner) e.getSource()).getValue())); vJoyDevicePanel.add(vJoyDeviceSpinner); final var hostPanel = new JPanel(panelFlowLayout); settingsPanel.add(hostPanel, panelGridBagConstraints); final var hostLabel = new JLabel(rb.getString("HOST_LABEL")); hostLabel.setPreferredSize(new Dimension(120, 15)); hostPanel.add(hostLabel); hostTextField = new JTextField(preferences.get(PREFERENCES_HOST, ClientVJoyOutputThread.DEFAULT_HOST), 10); final var setHostAction = new SetHostAction(hostTextField); hostTextField.addActionListener(setHostAction); hostTextField.addFocusListener(setHostAction); hostPanel.add(hostTextField); } final var portPanel = new JPanel(panelFlowLayout); settingsPanel.add(portPanel, panelGridBagConstraints); final var portLabel = new JLabel(rb.getString("PORT_LABEL")); portLabel.setPreferredSize(new Dimension(120, 15)); portPanel.add(portLabel); final var portSpinner = new JSpinner(new SpinnerNumberModel( preferences.getInt(PREFERENCES_PORT, ServerOutputThread.DEFAULT_PORT), 1024, 65535, 1)); final JSpinner.DefaultEditor portSpinnerEditor = new JSpinner.NumberEditor(portSpinner, "#"); ((DefaultFormatter) portSpinnerEditor.getTextField().getFormatter()).setCommitsOnValidEdit(true); portSpinner.setEditor(portSpinnerEditor); portSpinner.addChangeListener( e -> preferences.putInt(PREFERENCES_PORT, (int) ((JSpinner) e.getSource()).getValue())); portPanel.add(portSpinner); final var timeoutPanel = new JPanel(panelFlowLayout); settingsPanel.add(timeoutPanel, panelGridBagConstraints); final var timeoutLabel = new JLabel(rb.getString("TIMEOUT_LABEL")); timeoutLabel.setPreferredSize(new Dimension(120, 15)); timeoutPanel.add(timeoutLabel); final var timeoutSpinner = new JSpinner(new SpinnerNumberModel( preferences.getInt(PREFERENCES_TIMEOUT, ServerOutputThread.DEFAULT_TIMEOUT), 10, 60000, 1)); final JSpinner.DefaultEditor timeoutSpinnerEditor = new JSpinner.NumberEditor(timeoutSpinner, "#"); ((DefaultFormatter) timeoutSpinnerEditor.getTextField().getFormatter()).setCommitsOnValidEdit(true); timeoutSpinner.setEditor(timeoutSpinnerEditor); timeoutSpinner.addChangeListener( e -> preferences.putInt(PREFERENCES_TIMEOUT, (int) ((JSpinner) e.getSource()).getValue())); timeoutPanel.add(timeoutSpinner); final var alwaysOnTopSupported = Toolkit.getDefaultToolkit().isAlwaysOnTopSupported(); if (alwaysOnTopSupported || preferences.getBoolean(PREFERENCES_SHOW_OVERLAY, alwaysOnTopSupported)) { final var overlaySettingsPanel = new JPanel(panelFlowLayout); settingsPanel.add(overlaySettingsPanel, panelGridBagConstraints); final var overlayLabel = new JLabel(rb.getString("OVERLAY_LABEL")); overlayLabel.setPreferredSize(new Dimension(120, 15)); overlaySettingsPanel.add(overlayLabel); final var showOverlayCheckBox = new JCheckBox(rb.getString("SHOW_OVERLAY_CHECK_BOX")); showOverlayCheckBox.setSelected(preferences.getBoolean(PREFERENCES_SHOW_OVERLAY, true)); showOverlayCheckBox.addActionListener(e -> { final boolean showOverlay = ((JCheckBox) e.getSource()).isSelected(); preferences.putBoolean(PREFERENCES_SHOW_OVERLAY, showOverlay); }); overlaySettingsPanel.add(showOverlayCheckBox); } if (windows) { if (preferences.getBoolean(PREFERENCES_SHOW_VR_OVERLAY, true)) { final var vrOverlaySettingsPanel = new JPanel(panelFlowLayout); settingsPanel.add(vrOverlaySettingsPanel, panelGridBagConstraints); final var vrOverlayLabel = new JLabel(rb.getString("VR_OVERLAY_LABEL")); vrOverlayLabel.setPreferredSize(new Dimension(120, 15)); vrOverlaySettingsPanel.add(vrOverlayLabel); final var showVrOverlayCheckBox = new JCheckBox(rb.getString("SHOW_VR_OVERLAY_CHECK_BOX")); showVrOverlayCheckBox.setSelected(preferences.getBoolean(PREFERENCES_SHOW_VR_OVERLAY, true)); showVrOverlayCheckBox.addActionListener(e -> { final var showVrOverlay = ((JCheckBox) e.getSource()).isSelected(); preferences.putBoolean(PREFERENCES_SHOW_VR_OVERLAY, showVrOverlay); }); vrOverlaySettingsPanel.add(showVrOverlayCheckBox); } final var preventPowerSaveModeSettingsPanel = new JPanel(panelFlowLayout); settingsPanel.add(preventPowerSaveModeSettingsPanel, panelGridBagConstraints); final var preventPowerSaveModeLabel = new JLabel(rb.getString("POWER_SAVE_MODE_LABEL")); preventPowerSaveModeLabel.setPreferredSize(new Dimension(120, 15)); preventPowerSaveModeSettingsPanel.add(preventPowerSaveModeLabel); final var preventPowerSaveModeCheckBox = new JCheckBox( rb.getString("PREVENT_POWER_SAVE_MODE_CHECK_BOX")); preventPowerSaveModeCheckBox .setSelected(preferences.getBoolean(PREFERENCES_PREVENT_POWER_SAVE_MODE, true)); preventPowerSaveModeCheckBox.addActionListener(e -> { final var preventPowerSaveMode = ((JCheckBox) e.getSource()).isSelected(); preferences.putBoolean(PREFERENCES_PREVENT_POWER_SAVE_MODE, preventPowerSaveMode); }); preventPowerSaveModeSettingsPanel.add(preventPowerSaveModeCheckBox); } if (SystemTray.isSupported()) { final var popupMenu = new PopupMenu(); final var showAction = new ShowAction(); showMenuItem = new MenuItem((String) showAction.getValue(Action.NAME)); showMenuItem.addActionListener(showAction); popupMenu.add(showMenuItem); popupMenu.addSeparator(); final var openMenuItem = new MenuItem((String) openAction.getValue(Action.NAME)); openMenuItem.addActionListener(openAction); popupMenu.add(openMenuItem); popupMenu.addSeparator(); final var quitMenuItem = new MenuItem((String) quitAction.getValue(Action.NAME)); quitMenuItem.addActionListener(quitAction); popupMenu.add(quitMenuItem); trayIcon = new TrayIcon(frame.getIconImage()); trayIcon.addActionListener(showAction); trayIcon.setPopupMenu(popupMenu); try { SystemTray.getSystemTray().add(trayIcon); } catch (final AWTException e) { log.log(Logger.Level.ERROR, e.getMessage(), e); } } updateTitleAndTooltip(); settingsPanel.add(Box.createGlue(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); final var outsideBorder = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); final var insideBorder = BorderFactory.createEmptyBorder(0, 5, 0, 5); statusLabel.setBorder(BorderFactory.createCompoundBorder(outsideBorder, insideBorder)); frame.add(statusLabel, BorderLayout.SOUTH); final var glfwInitialized = glfwInit(); if (!glfwInitialized) if (windows) JOptionPane.showMessageDialog(frame, rb.getString("COULD_NOT_INITIALIZE_GLFW_DIALOG_TEXT_WINDOWS"), rb.getString("ERROR_DIALOG_TITLE"), JOptionPane.ERROR_MESSAGE); else { JOptionPane.showMessageDialog(frame, rb.getString("COULD_NOT_INITIALIZE_GLFW_DIALOG_TEXT"), rb.getString("ERROR_DIALOG_TITLE"), JOptionPane.ERROR_MESSAGE); quit(); } final var presentJids = new HashSet<Integer>(); for (var jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++) if (glfwJoystickPresent(jid) && glfwJoystickIsGamepad(jid)) presentJids.add(jid); final var lastControllerGuid = preferences.get(PREFERENCES_LAST_CONTROLLER, null); for (final var jid : presentJids) { final var lastControllerFound = lastControllerGuid != null ? lastControllerGuid.equals(glfwGetJoystickGUID(jid)) : false; if (!isSelectedJidValid() || lastControllerFound) selectedJid = jid; if (lastControllerFound) break; } newProfile(); onControllersChanged(true); glfwSetJoystickCallback(new GLFWJoystickCallback() { @Override public void invoke(final int jid, final int event) { final var disconnected = event == GLFW_DISCONNECTED; if (disconnected || glfwJoystickIsGamepad(jid)) { if (disconnected && selectedJid == jid) selectedJid = INVALID_JID; invokeOnEventDispatchThreadIfRequired(() -> onControllersChanged(false)); } } }); if (glfwInitialized && presentJids.isEmpty()) { if (windows) JOptionPane.showMessageDialog(frame, rb.getString("NO_CONTROLLER_CONNECTED_DIALOG_TEXT_WINDOWS"), rb.getString("INFORMATION_DIALOG_TITLE"), JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog(frame, rb.getString("NO_CONTROLLER_CONNECTED_DIALOG_TEXT"), rb.getString("INFORMATION_DIALOG_TITLE"), JOptionPane.INFORMATION_MESSAGE); } else { final String path = preferences.get(PREFERENCES_LAST_PROFILE, null); if (path != null) loadProfile(new File(path)); } }
From source file:FirstForm.java
private void initSpinners() { defaultBorder = this.indiceSpinner.getBorder(); this.indiceSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 30.0, 0.1)); this.faseModuladoraSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 100000.0, 0.1)); this.fasePortadoraSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 100000.0, 0.1)); this.amplitudModuladoraSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 100000.0, 0.1)); this.amplitudPortadoraSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 100000.0, 0.1)); this.frecuenciaPortadoraSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 100000.0, 0.1)); this.frecuenciaModuladoraSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 100000.0, 0.1)); this.sensibilidadSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, 100000.0, 0.1)); this.sensibilidadSpinner.addChangeListener(new ChangeListener() { @Override// ww w . jav a 2 s. c o m public void stateChanged(ChangeEvent e) { indiceOrSensibility = false; indiceSpinner.setBorder(defaultBorder); sensibilidadSpinner.setBorder(BorderFactory.createLineBorder(new Color(39, 174, 96))); } }); this.indiceSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { indiceOrSensibility = true; sensibilidadSpinner.setBorder(defaultBorder); indiceSpinner.setBorder(BorderFactory.createLineBorder(new Color(39, 174, 96))); } }); this.indiceSpinner.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. indiceOrSensibility = true; sensibilidadSpinner.setBorder(defaultBorder); indiceSpinner.setBorder(BorderFactory.createLineBorder(new Color(39, 174, 96))); } @Override public void focusLost(FocusEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); this.sensibilidadSpinner.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. indiceOrSensibility = false; indiceSpinner.setBorder(defaultBorder); sensibilidadSpinner.setBorder(BorderFactory.createLineBorder(new Color(39, 174, 96))); } @Override public void focusLost(FocusEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); }