title: adding tabs in java (swing)
body: <p>i was given a project to make a java program named doctors care which has login panel( username and password) and a panel which has 3 tabs. the problem is i could add only one tab and when i tried to add another tab by duplicating the objects( like label2, panel2 etc) it does not appear in the executed JAR file. i have posted the code below. </p>
  
  <p>public void actionPerformed(ActionEvent ae)</p>
  
  <pre><code>   {String value1 = text1.getText();
      String value2 = text2.getText();
      if(value1.equals("admin") &amp;&amp; value2.equals("admin123456")) {
          NextPage page=new NextPage();
          page.setVisible(true);
  
          JTabbedPane tabbedPane1 = new JTabbedPane();
          ImageIcon icon1 = createImageIcon("images/middle.gif");
          JComponent panel1 = makeTextPanel("panel#1");
          tabbedPane1.addTab("Booking", icon1, panel1, "For booking appointments");
          JLabel label = new JLabel("Welcome "+value1);
          page.getContentPane().add(label);
          page.getContentPane().add(tabbedPane1);
          //page.add(icon);
          page.getContentPane().add(panel1);
  
    JTabbedPane tabbedPane2 = new JTabbedPane();
      ImageIcon icon2 = createImageIcon("images/middle.gif");
      JComponent panel2 = makeTextPanel("panel#2");
      tabbedPane2.addTab("Doctors", icon2, panel2, "For choosing appointments");
      JLabel label2 = new JLabel("Welcome "+value2);
      page.getContentPane().add(label2);
      page.getContentPane().add(tabbedPane2);
      //page.add(icon2);
      page.getContentPane().add(panel2);}
  </code></pre>