title: Pass information from JFrames
body: <p>In these codes I get information of how many Job is available (JobCount) and in the next <code>JFrame</code> I want to put <code>JobCount</code> times <code>JToggleButtton</code>. but the <code>JobCount</code> doesn't pass correctly. How can I make it so it can pass information from frames?</p>
  
  <pre><code>public class NewJFrame extends javax.swing.JFrame {
  
  public NewJFrame() {
      initComponents();
  }
    public int PeopleCount;
  public int JobCount;
  public  JFrame2 jf2;
  
  private void PJCountjButtonActionPerformed(java.awt.event.ActionEvent evt) {                                               
      PeopleCount=(int)(PeopleCountjSpinner.getValue());
      JOptionPane.showMessageDialog(null, "peoplecount="+PeopleCount);
      JobCount=(int)(JobCountjSpinner.getValue());
      jf2=new JFrame2();
      jf2.setVisible(true);
      jf2.c1=this;
      this.setVisible(false);  
  }
  public static void main(String args[]) {
  java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
              new NewJFrame().setVisible(true);
          }
      });
  }
  public class JFrame2 extends javax.swing.JFrame {
  
  int j;
  public NewJFrame c1 = new NewJFrame();
  
  JPanel contentpane;
  JButton show;
  public JButton[] jbarray = new JButton[c1.JobCount];
  public int array[][] = new int[c1.PeopleCount][c1.JobCount];
  
  public JFrame2() {
      initComponents();
      JOptionPane.showMessageDialog(null, "peoplecount="+c1.PeopleCount);
      this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
      this.setBounds(10, 01, 500, 400);
      this.contentpane = new JPanel();
      this.show = new JButton("Show array");
      contentpane.add(show);
  
      for (j = 0; j &lt; c1.JobCount; j++) {
          this.jbarray[j] = new JButton("job" + (j + 1));
          contentpane.add(jbarray[j]);
      }
  
      this.setContentPane(contentpane);
      this.setVisible(true);
  }}
      // Variables declaration - do not modify                     
  private javax.swing.JSpinner JobCountjSpinner;
  private javax.swing.JButton PJCountjButton;
  private javax.swing.JSpinner PeopleCountjSpinner;
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jLabel2;
  // End of variables declaration          }
  </code></pre>