How to switch tabs in jTabbedPane by clicking a Button?
<p>I have a JTabbedPanewith to JTabbedPane1,2 
How can i press button in JTabbedPane2 to show JTabbedPane1 ?</p>

<p>Here main JTabbedPane:</p>

<pre><code>public class TabbedPane extends JFrame {

    public TabbedPane() {


        setTitle("Tabbed Pane");  
        setSize(300,300); 

        JTabbedPane jtp = new JTabbedPane();

       getContentPane().add(jtp);

       JPanel1 jp1 = new JPanel1();//This will create the first tab

       JPanel jp2 = new JPanel2();//This will create the second tab

       //add panel .........

    //example usage
     public static void main (String []args){
        TabbedPane tab = new TabbedPane();
    }

}
</code></pre>

<p>here is class JPane1:</p>

<pre><code>...    JLabel label1 = new JLabel();
       label1.setText("This is Tab 1");
       jp1.add(label1);
</code></pre>

<p>and class Jpane2 with button on int</p>

<p>JButton test = new JButton("Press");
   jp2.add(test);</p>

<pre><code>ButtonHandler phandler = new ButtonHandler();
test.addActionListener(phandler);
setVisible(true); 
</code></pre>

<p>}
 so problem is here in ActionListener of button on Jpanel2  </p>

<pre><code>class ButtonHandler implements ActionListener{
       public void actionPerformed(ActionEvent e){
              // what i do now ? to call  jpanel 1 show ![alt text][1]
       }
}
</code></pre>

<p><img src="http://i.stack.imgur.com/ZRUT4.png" alt="alt text"></p>
