title: How can activate another gui class with JButton
body: <p>I have two GUI classes named Menu and convert. I want to run the convert class when I click the "open" button. It looks so simple, but I couldn't figure it out.</p>
  
  <p>Menu class</p>
  
  <pre><code>package com.ui;
  
  import java.awt.EventQueue;
  
  import javax.swing.JFrame;
  import javax.swing.JButton;
  import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  
  public class Menu {
  
  private JFrame frame;
  
  /**
   * Launch the application.
   */
  public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  Menu window = new Menu();
                  window.frame.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the application.
   */
  public Menu() {
      initialize();
  }
  
  /**
   * Initialize the contents of the frame.
   */
  private void initialize() {
      frame = new JFrame();
      frame.setBounds(100, 100, 450, 300);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      JButton btnConvert = new JButton("open");
      btnConvert.setBounds(44, 52, 89, 23);
      btnConvert.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
              //???
          }
      });
      frame.getContentPane().setLayout(null);
      frame.getContentPane().add(btnConvert);
  }
  }
  </code></pre>
  
  <p>convert class</p>
  
  <pre><code>package com.ui;
  
  import java.awt.EventQueue;
  
  import javax.swing.ButtonGroup;
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import javax.swing.JTextField;
  import javax.swing.JPanel;
  import javax.swing.JRadioButton;
  import javax.swing.border.TitledBorder;
  import java.awt.Color;
  import javax.swing.JComboBox;
  import javax.swing.DefaultComboBoxModel;
  import javax.swing.JButton;
  import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  
  
  public class convert {
  
  private JFrame frmTitle;
  private JTextField textField;
  
  private double value;
  
  private ButtonGroup group;
  
  /**
   * Launch the application.
   */
  public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  convert window = new convert();
                  window.frmTitle.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the application.
   */
  public convert() {
      initialize();
  
  }
  
  /**
   * Initialize the contents of the frame.
   */
  private void initialize() {
  
      frmTitle = new JFrame();
      frmTitle.setTitle("TITLE");
      frmTitle.setBounds(100, 100, 450, 300);
      frmTitle.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frmTitle.getContentPane().setLayout(null);
  
      JLabel lblInputValue = new JLabel("Input value:");
      lblInputValue.setBounds(29, 22, 79, 14);
      frmTitle.getContentPane().add(lblInputValue);
  
      textField = new JTextField();
      textField.setBounds(22, 47, 86, 20);
      frmTitle.getContentPane().add(textField);
      textField.setColumns(10);
  
      JPanel panel = new JPanel();
      panel.setBorder(new TitledBorder(null, "Convert", TitledBorder.LEADING, TitledBorder.TOP, null, Color.RED));
      panel.setBounds(29, 118, 264, 133);
      frmTitle.getContentPane().add(panel);
      panel.setLayout(null);
  
      final JRadioButton rdbtnKelvin = new JRadioButton("Kelvin");
      rdbtnKelvin.setBounds(6, 30, 67, 23);
      panel.add(rdbtnKelvin);
  
      final JRadioButton rdbtnFahrenheit = new JRadioButton("Fahrenheit");
      rdbtnFahrenheit.setBounds(71, 30, 77, 23);
      panel.add(rdbtnFahrenheit);
  
      final JRadioButton rdbtnCelcius = new JRadioButton("Celcius");
      rdbtnCelcius.setBounds(174, 30, 67, 23);
      panel.add(rdbtnCelcius);
  
      group = new ButtonGroup();
      group.add(rdbtnCelcius);
      group.add(rdbtnFahrenheit);
      group.add(rdbtnKelvin);
  
      final JComboBox comboBox = new JComboBox();
      comboBox.setModel(new DefaultComboBoxModel(new String[] {"Celcius", "Fahrenheit", "Kelvin"}));
      comboBox.setBounds(177, 47, 116, 20);
      frmTitle.getContentPane().add(comboBox);
  
      JButton btnConvert = new JButton("CONVERT");
      btnConvert.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
  
              value = Double.parseDouble(textField.getText().toString());
  
  
              if(comboBox.getSelectedItem().toString().equals("Celcius")){
  
  
                  if(rdbtnCelcius.isSelected()==true){
                      value = value;
  
                  }
                  else if (rdbtnFahrenheit.isSelected()==true){
                      value= 1.8*value +32;
                  }
                  else{
                      value =value+273;
  
                  }                   
              } 
              else if (comboBox.getSelectedItem().toString().equals("Fahrenheit")){
  
                  if(rdbtnFahrenheit.isSelected()==true){
                      value = value;
  
                  }
                  else if (rdbtnCelcius.isSelected()==true){
                      value= (value-32)*1.8;  
                  }
                  else{
                      value =(value-32)/1.8+273;
                  }
              } 
              else{ 
                  if(rdbtnCelcius.isSelected()==true){
                      value = value-273;
                  }
                  else if (rdbtnFahrenheit.isSelected()==true){
                      value= value -273*1.8+32;   
                  }
                  else{
                      value =value;                       
                  }
              }
  
              textField.setText(value +"");
              textField.setEnabled(false);
          }
      });
      btnConvert.setBounds(303, 114, 89, 23);
      frmTitle.getContentPane().add(btnConvert);
  
      JButton btnClear = new JButton("CLEAR");
      btnClear.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
              textField.setText("");
              textField.setEnabled(true);
              comboBox.setSelectedIndex(0);
              rdbtnKelvin.setSelected(true);
  
          }
      });
      btnClear.setBounds(303, 170, 89, 23);
      frmTitle.getContentPane().add(btnClear);
  }
  }
  </code></pre>