title: JAVA external Frame to control array
body: <p>I have very simple code, just 2 buttons to display numbers from array in textArea.</p>
  
  <pre><code>public class FotyUI extends javax.swing.JFrame {
      public FotyUI() {
          initComponents();
      }
  int[] numbers = {0,1,2,3,4,5,6,7,8,9};
  int position  = 0;
  
  private void nextActionPerformed(java.awt.event.ActionEvent evt) {                                     
           position ++;
          tekst.setText(" " + numbers[position]);
  
      }        
  
  
  
  private void previousActionPerformed(java.awt.event.ActionEvent evt) {                                         
       position--; 
      tekst.setText(" " + numbers[position]);
  
  }    
  </code></pre>
  
  <p>Now, this code runs great I have two buttons and textArea, but I would like to create an external JFrame2 with 2 buttons to control/display array from Frame 1<br>
  When I type: </p>
  
  <pre><code>public class FotyUI extends javax.swing.JFrame {
  
  
      public FotyUI() {
          initComponents();
      }
  int[] numbers = {0,1,2,3,4,5,6,7,8,9};
  int position  = 0;
  
  
  
  JFrame temp = new JFrame();
  JPanel panelik = new JPanel();
  JButton nextS = new JButton("Next");
  JButton prevS = new JButton("Previous");
  panelik.add(nextS);
  </code></pre>
  
  <p>I have an error to create package panelik....
  Can u help me ? How to create Frame 2 with 2 buttons and textArea to display/control content of array from Frame1</p>