title: Passing info from one Jframe to another
body: <p>I have my original text field in my first frame and I need it to be displayed in my other jframe. The code is:</p>
  
  <pre><code>JButton btnContinue = new JButton("Continue");
      btnContinue.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
  
              String msg = nameL.getText();
  
              frame2 fram = new frame2 ();
              fram.setVisible(true);
              frame.dispose();
  
              new order (msg) .setVisible(true);
  </code></pre>
  
  <p>'nameL' is the textbox the user enters their name in.</p>
  
  <p>This code describe where it should be displayed:</p>
  
  <pre><code>public order(String para){
          getComponents();
  
  
      JLabel lblNewLabel_1 = new JLabel("");
      lblNewLabel_1.setBounds(91, 27, 254, 84);
      contentPane.add(lblNewLabel_1);
      lblNewLabel_1.setText(para);
  </code></pre>
  
  <p>this is my first class where the user inputs their name</p>
  
  <pre><code>public order(String para){
          getComponents();
  
  
      import java.awt.EventQueue;
    import javax.swing.JFrame;
   import javax.swing.JButton;
   import javax.swing.JTextField;
   import javax.swing.JTextArea;
   import java.awt.Color;
   import java.awt.event.ActionListener;
   import java.awt.event.ActionEvent;
   import java.awt.Font;
  
   public class frame1 {
  
  public JFrame frame;
  public JTextField nameL;
  public JTextField textField_1;
  
  /**
   * Launch the application.
   */
  public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  frame1 window = new frame1();
                  window.frame.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the application.
   */
  public frame1() {
      initialize();
  }
  
  /**
   * Initialize the contents of the frame.
   */
  private void initialize() {
      frame = new JFrame();
      frame.getContentPane().setEnabled(false);
      frame.setResizable(false);
      frame.getContentPane().setBackground(Color.GRAY);
      frame.setForeground(Color.WHITE);
      frame.setBounds(100, 100, 450, 300);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.getContentPane().setLayout(null);
  
      JButton btnContinue = new JButton("Continue");
      btnContinue.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
  
              String msg = nameL.getText();
  
              frame2 fram = new frame2 ();
              fram.setVisible(true);
              frame.dispose();
  
              new order (msg) .setVisible(true);
  
          }
          }
  
      );
      btnContinue.setBounds(0, 249, 450, 29);
      frame.getContentPane().add(btnContinue);
  
      JTextArea txtrPleaseEnterYour = new JTextArea();
      txtrPleaseEnterYour.setEditable(false);
      txtrPleaseEnterYour.setBackground(Color.LIGHT_GRAY);
      txtrPleaseEnterYour.setBounds(0, 0, 450, 32);
      txtrPleaseEnterYour.setText("\tPlease enter your name and email below\n If you do not have or want to provide an email, Leave the space blank");
      frame.getContentPane().add(txtrPleaseEnterYour);
  
      JTextArea txtrEnterYourFull = new JTextArea();
      txtrEnterYourFull.setEditable(false);
      txtrEnterYourFull.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
      txtrEnterYourFull.setBackground(Color.GRAY);
      txtrEnterYourFull.setText("Enter your full name");
      txtrEnterYourFull.setBounds(52, 58, 166, 29);
      frame.getContentPane().add(txtrEnterYourFull);
  
  
  
      nameL = new JTextField();
      nameL.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
  
          }
      }
      );
      nameL.setBackground(Color.LIGHT_GRAY);
      nameL.setBounds(52, 93, 284, 26);
      frame.getContentPane().add(nameL);
      nameL.setColumns(10);
  
  
      JTextArea txtroptionalEnterYour = new JTextArea();
      txtroptionalEnterYour.setEditable(false);
      txtroptionalEnterYour.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
      txtroptionalEnterYour.setBackground(Color.GRAY);
      txtroptionalEnterYour.setText("(Optional) Enter your email");
      txtroptionalEnterYour.setBounds(52, 139, 193, 29);
      frame.getContentPane().add(txtroptionalEnterYour);
  
      textField_1 = new JTextField();
      textField_1.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
  
          }
      });
      textField_1.setBackground(Color.LIGHT_GRAY);
      textField_1.setBounds(52, 180, 284, 26);
      frame.getContentPane().add(textField_1);
      textField_1.setColumns(10);
  
   }
    }
  </code></pre>
  
  <p>my second class where the text field has to be set</p>
  
  <pre><code>import java.awt.EventQueue;
  
   import javax.swing.JFrame;
   import javax.swing.JOptionPane;
   import javax.swing.JPanel;
   import javax.swing.border.EmptyBorder;
   import java.awt.Color;
   import javax.swing.JButton;
   import java.awt.event.ActionListener;
   import java.awt.event.ActionEvent;
   import javax.swing.JLabel;
  
   public class order extends JFrame {
  
  /**
   * 
   */
  private static final long serialVersionUID = 1L;
  public JPanel contentPane;
  /**
   * Launch the application.
   */
  
  public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  order frame = new order();
                  frame.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the frame.
   */
  public order() {
      setAlwaysOnTop(false);
      setTitle("Order Details // Finalization");
      setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      setBounds(100, 100, 451, 523);
      contentPane = new JPanel();
      contentPane.setBackground(Color.LIGHT_GRAY);
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
      contentPane.setLayout(null);
  
      JButton btnNewButton = new JButton("Submit Order");
      btnNewButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
              setAlwaysOnTop(true);
              JOptionPane.showMessageDialog(null, "Your Order Has Been Confirmed", "enjoy your meal", JOptionPane.YES_NO_OPTION);
  
          }
      });
      btnNewButton.setBounds(164, 466, 117, 29);
      contentPane.add(btnNewButton);
  
  }
  
      public order(String para){
          getComponents();    
  
      JLabel lblNewLabel_1 = new JLabel("");
      lblNewLabel_1.setBounds(91, 27, 254, 84);
      contentPane.add(lblNewLabel_1);
      lblNewLabel_1.setText(para);
  
  
      }
      }
  </code></pre>