Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package RutherfordScattering; import AsymptoticFreedom.AppletAF; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.XYPlot; /** * * @author Geonmo */ public class RutherfordScattering extends javax.swing.JApplet { javax.swing.Timer timer; Boolean isTimerOn = false; JFreeChart chart; /** * Initializes the applet RutherfordScattering */ @Override public void init() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the applet */ try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { initComponents(); chart = new JFreeChart(new XYPlot()); } }); } catch (Exception ex) { ex.printStackTrace(); } } /** * This method is called from within the init() method to initialize the * form. WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); jSeparator1 = new javax.swing.JSeparator(); jButton1 = new javax.swing.JButton(); ResetButton1 = new javax.swing.JButton(); StartButton1 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jInternalFrame1 = new javax.swing.JInternalFrame(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); GraphViewPanel = new GraphViewPanel(chart); OptionPanel = new javax.swing.JPanel(); StartButton = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); ImpactParameterSpinner = new javax.swing.JSpinner(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); InitVelocitySpinner = new javax.swing.JSpinner(); ImpactParameterSlider = new javax.swing.JSlider(); InitialVelocitySlider = new javax.swing.JSlider(); ResetButton = new javax.swing.JButton(); ImpactViewPanel = new ImpactViewPanel(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); RuOptionPanel = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); InitVelocitySpinner1 = new javax.swing.JSpinner(); InitialVelocitySlider1 = new javax.swing.JSlider(); ResetButton2 = new javax.swing.JButton(); StartButton2 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton1.setText("jButton1"); ResetButton1.setText("Reset"); ResetButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ResetButton1ActionPerformed(evt); } }); StartButton1.setText("Start"); StartButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { StartButton1ActionPerformed(evt); } }); jButton4.setText("Quit"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jInternalFrame1.setMaximumSize(new java.awt.Dimension(800, 600)); jInternalFrame1.setMinimumSize(new java.awt.Dimension(800, 600)); jInternalFrame1.setPreferredSize(new java.awt.Dimension(800, 600)); jInternalFrame1.setVisible(true); jTabbedPane1.setMaximumSize(new java.awt.Dimension(780, 570)); jTabbedPane1.setMinimumSize(new java.awt.Dimension(780, 570)); jTabbedPane1.setPreferredSize(new java.awt.Dimension(780, 570)); jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); jPanel1.setMaximumSize(new java.awt.Dimension(800, 600)); jPanel1.setMinimumSize(new java.awt.Dimension(800, 600)); jPanel1.setPreferredSize(new java.awt.Dimension(800, 600)); GraphViewPanel .setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); GraphViewPanel.setMaximumSize(new java.awt.Dimension(550, 260)); GraphViewPanel.setMinimumSize(new java.awt.Dimension(550, 260)); GraphViewPanel.setPreferredSize(new java.awt.Dimension(550, 260)); GraphViewPanel.setRequestFocusEnabled(false); javax.swing.GroupLayout GraphViewPanelLayout = new javax.swing.GroupLayout(GraphViewPanel); GraphViewPanel.setLayout(GraphViewPanelLayout); GraphViewPanelLayout.setHorizontalGroup(GraphViewPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 551, Short.MAX_VALUE)); GraphViewPanelLayout.setVerticalGroup(GraphViewPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 256, Short.MAX_VALUE)); OptionPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); StartButton.setText("Start"); StartButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { StartButtonActionPerformed(evt); } }); jButton3.setText("Quit"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, ImpactParameterSlider, org.jdesktop.beansbinding.ELProperty.create("${value}"), ImpactParameterSpinner, org.jdesktop.beansbinding.BeanProperty.create("value")); bindingGroup.addBinding(binding); ImpactParameterSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { ImpactParameterSpinnerStateChanged(evt); } }); jLabel1.setText("Impact Parameter(alpha = 1)"); jLabel2.setText("Initial Velocity(c)"); InitVelocitySpinner.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 1.0d, 0.01d)); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, InitialVelocitySlider, org.jdesktop.beansbinding.ELProperty.create("${value/100}"), InitVelocitySpinner, org.jdesktop.beansbinding.BeanProperty.create("value")); bindingGroup.addBinding(binding); InitVelocitySpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { InitVelocitySpinnerStateChanged(evt); } }); ImpactParameterSlider.setMaximum(20); ImpactParameterSlider.setMinimum(-20); ImpactParameterSlider.setValue(0); ResetButton.setText("Reset"); ResetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ResetButtonActionPerformed(evt); } }); javax.swing.GroupLayout OptionPanelLayout = new javax.swing.GroupLayout(OptionPanel); OptionPanel.setLayout(OptionPanelLayout); OptionPanelLayout .setHorizontalGroup(OptionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, OptionPanelLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(InitialVelocitySlider, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30)) .addGroup(OptionPanelLayout.createSequentialGroup().addContainerGap() .addGroup(OptionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(OptionPanelLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(OptionPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(ImpactParameterSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(OptionPanelLayout.createSequentialGroup() .addGroup(OptionPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2)) .addGap(25, 25, 25)) .addComponent(InitVelocitySpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, OptionPanelLayout .createSequentialGroup() .addComponent(StartButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(OptionPanelLayout.createSequentialGroup() .addComponent(ImpactParameterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(OptionPanelLayout.createSequentialGroup() .addComponent(ResetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18))) .addContainerGap())); OptionPanelLayout.setVerticalGroup(OptionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, OptionPanelLayout.createSequentialGroup() .addGap(32, 32, 32).addComponent(jLabel1).addGap(5, 5, 5) .addComponent(ImpactParameterSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(ImpactParameterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(InitVelocitySpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(InitialVelocitySlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(ResetButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(OptionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(StartButton).addComponent(jButton3)) .addGap(96, 96, 96))); ImpactViewPanel .setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); javax.swing.GroupLayout ImpactViewPanelLayout = new javax.swing.GroupLayout(ImpactViewPanel); ImpactViewPanel.setLayout(ImpactViewPanelLayout); ImpactViewPanelLayout.setHorizontalGroup(ImpactViewPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); ImpactViewPanelLayout.setVerticalGroup(ImpactViewPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 271, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(GraphViewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 555, Short.MAX_VALUE) .addComponent(ImpactViewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 555, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(OptionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 6, Short.MAX_VALUE))); jPanel1Layout .setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(OptionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(ImpactViewPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(GraphViewPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 51, Short.MAX_VALUE))); jTabbedPane1.addTab("Impact parameter and cross section", jPanel1); jPanel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 579, Short.MAX_VALUE)); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); RuOptionPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); jLabel3.setText("Initial Velocity(c)"); InitVelocitySpinner1.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 1.0d, 0.01d)); InitVelocitySpinner1.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { InitVelocitySpinner1StateChanged(evt); } }); ResetButton2.setText("Reset"); ResetButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ResetButton2ActionPerformed(evt); } }); StartButton2.setText("Start"); StartButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { StartButton2ActionPerformed(evt); } }); jButton5.setText("Quit"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); javax.swing.GroupLayout RuOptionPanelLayout = new javax.swing.GroupLayout(RuOptionPanel); RuOptionPanel.setLayout(RuOptionPanelLayout); RuOptionPanelLayout.setHorizontalGroup(RuOptionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(RuOptionPanelLayout.createSequentialGroup().addContainerGap() .addComponent(ResetButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) .addGroup(RuOptionPanelLayout.createSequentialGroup().addGroup(RuOptionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( RuOptionPanelLayout.createSequentialGroup().addContainerGap().addComponent(jLabel3)) .addGroup(RuOptionPanelLayout.createSequentialGroup().addGap(38, 38, 38).addComponent( InitVelocitySpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(RuOptionPanelLayout.createSequentialGroup().addContainerGap().addComponent( InitialVelocitySlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(RuOptionPanelLayout.createSequentialGroup() .addComponent(StartButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 0, Short.MAX_VALUE))); RuOptionPanelLayout.setVerticalGroup(RuOptionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(RuOptionPanelLayout.createSequentialGroup().addGap(20, 20, 20).addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(InitVelocitySpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(InitialVelocitySlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(204, 204, 204).addComponent(ResetButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( RuOptionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(StartButton2).addComponent(jButton5)) .addContainerGap(166, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE) .addComponent(RuOptionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(RuOptionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); jTabbedPane1.addTab("Rutherford scattering", jPanel2); javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout( jInternalFrame1.getContentPane()); jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); jInternalFrame1Layout.setHorizontalGroup( jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 784, Short.MAX_VALUE)); jInternalFrame1Layout.setVerticalGroup(jInternalFrame1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); bindingGroup.bind(); }// </editor-fold>//GEN-END:initComponents public class aListener implements ActionListener { public void actionPerformed(ActionEvent e) { ((ImpactViewPanel) ImpactViewPanel).goStep(); repaint(); ((GraphViewPanel) GraphViewPanel).FillValue(((ImpactViewPanel) ImpactViewPanel).getDistance()); } }; public void timerStart() { if (timer == null) { System.out.println("Start Timer!!"); timer = new javax.swing.Timer(100, new RutherfordScattering.aListener()); timer.stop(); } timer.start(); isTimerOn = true; } public void timerStop() { timer.stop(); isTimerOn = false; } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: setVisible(false); //dispose(); System.exit(0); }//GEN-LAST:event_jButton3ActionPerformed private void ImpactParameterSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_ImpactParameterSpinnerStateChanged // TODO add your handling code here: ((ImpactViewPanel) ImpactViewPanel).setIP((int) ImpactParameterSlider.getValue()); ((ImpactViewPanel) ImpactViewPanel).resetPanel(); }//GEN-LAST:event_ImpactParameterSpinnerStateChanged private void StartButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StartButtonActionPerformed // TODO add your handling code here: if (isTimerOn) { timerStop(); StartButton.setText("Start"); } else { timerStart(); StartButton.setText("Pause"); } }//GEN-LAST:event_StartButtonActionPerformed private void ResetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ResetButtonActionPerformed // TODO add your handling code here: ((ImpactViewPanel) ImpactViewPanel).resetPanel(); }//GEN-LAST:event_ResetButtonActionPerformed private void InitVelocitySpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_InitVelocitySpinnerStateChanged // TODO add your handling code here: ((ImpactViewPanel) ImpactViewPanel).setVelocity((double) InitVelocitySpinner.getValue()); ((ImpactViewPanel) ImpactViewPanel).resetPanel(); }//GEN-LAST:event_InitVelocitySpinnerStateChanged private void InitVelocitySpinner1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_InitVelocitySpinner1StateChanged // TODO add your handling code here: }//GEN-LAST:event_InitVelocitySpinner1StateChanged private void ResetButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ResetButton1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ResetButton1ActionPerformed private void StartButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StartButton1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_StartButton1ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton4ActionPerformed private void ResetButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ResetButton2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ResetButton2ActionPerformed private void StartButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StartButton2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_StartButton2ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton5ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel GraphViewPanel; private javax.swing.JSlider ImpactParameterSlider; private javax.swing.JSpinner ImpactParameterSpinner; private javax.swing.JPanel ImpactViewPanel; private javax.swing.JSpinner InitVelocitySpinner; private javax.swing.JSpinner InitVelocitySpinner1; private javax.swing.JSlider InitialVelocitySlider; private javax.swing.JSlider InitialVelocitySlider1; private javax.swing.JPanel OptionPanel; private javax.swing.JButton ResetButton; private javax.swing.JButton ResetButton1; private javax.swing.JButton ResetButton2; private javax.swing.JPanel RuOptionPanel; private javax.swing.JButton StartButton; private javax.swing.JButton StartButton1; private javax.swing.JButton StartButton2; private javax.swing.JButton jButton1; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JInternalFrame jInternalFrame1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JSeparator jSeparator1; private javax.swing.JTabbedPane jTabbedPane1; private org.jdesktop.beansbinding.BindingGroup bindingGroup; // End of variables declaration//GEN-END:variables }