title: How to add more then one radio button to form and how to connect two forms in java?
body: <p>I am totally new to JAVA..i want to create a form with two Radio buttons on it,one for student and other for teacher. when the user clicks on student another form related to student should open and when user clicks on teacher,teachers form should open and then ask the user to enter related data....here is my code for first for....</p>
  
  <pre><code>import java.awt.*;
  
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.JRadioButton;
  import javax.swing.border.EmptyBorder;
  
  public class Frm1 extends JFrame {
  
      private JPanel contentPane;
  
      /**
       * Launch the application.
       */
      public static void main(String[] args) {
          EventQueue.invokeLater(new Runnable() {
              public void run() {
                  try {
                      Frm1 frame = new Frm1();
                      frame.setVisible(true);
  
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          });
      }
  
      /**
       * Create the frame.
       */
      public Frm1() {
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setBounds(100, 100, 450, 300);
          contentPane = new JPanel();
          contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
          contentPane.setLayout(new BorderLayout(0, 0));
          setContentPane(contentPane);
          JRadioButton rb1=new JRadioButton("STUDENT");
          add(rb1);
          JRadioButton rb2=new JRadioButton("TEACHER"); 
          add(rb2);
  
  
  
      }
  
  }
  </code></pre>
  
  <p>it adds only teacher radio button to the form not the student,can any one help plus how will i make the program to go to teacher or student form when respective radio button is selected.</p>
  
  <p>thanks in advance</p>