Hi, i have some problem in my code.In this code i have made two Panels(p1 and p2) and one tabbed pane(tp) in which i have added
second panel(p2). on panel 1 i have one button(Go to Tabbed Pane). I want, when i will click on this button,
then the tabbed pane should be added to the frame like this (f.getContentPane().add(tabbed pane); )
but at the same time i want panel 1 to be invisible. in short on the button click i want :
f.getContentPane().add(tabbed pane);
tabbed pane.setVisible(true);
panel_1.setVisible(false);
please do some changes in my code and send me . thank you very much

import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class MultiPanel implements ActionListener
{
JFrame f;
JTabbedPane tp;
JPanel p1,p2;
JLabel l1,l2;
JPasswordField pf;
JButton btn1,btn2;
SpringLayout sl;

MultiPanel()
{
f=new JFrame("Multi Panel Working...");
tp=new JTabbedPane();
tp.setTabPlacement(JTabbedPane.TOP);
p1=new JPanel();
p2=new JPanel();
l1=new JLabel("Enter Password:");
l2=new JLabel("Welcome To Tabbed Pane:");
pf=new JPasswordField(12);
btn1=new JButton("Go to Tabbed Pane");
btn2=new JButton("Go to Panel 1");
sl= new SpringLayout();
}

void dis()
{
f.getContentPane().add(p1);
p1.setLayout(sl);
p2.setLayout(sl);
p1.add(l1);
p1.add(pf);
p2.add(l2);
p1.add(btn1);
p2.add(btn2);

sl.putConstraint(SpringLayout.WEST, l1,375, SpringLayout.WEST, p1 );
sl.putConstraint(SpringLayout.NORTH,l1,200, SpringLayout.NORTH, p1 );

sl.putConstraint(SpringLayout.WEST, pf,475, SpringLayout.WEST, p1 );
sl.putConstraint(SpringLayout.NORTH,pf,200, SpringLayout.NORTH, p1 );

sl.putConstraint(SpringLayout.WEST, btn1,500,SpringLayout.WEST, p1 );
sl.putConstraint(SpringLayout.NORTH,btn1,300,Sprin gLayout.NORTH,p1 );

sl.putConstraint(SpringLayout.WEST, l2, 375, SpringLayout.WEST, p2 );
sl.putConstraint(SpringLayout.NORTH,l2, 200, SpringLayout.NORTH,p2 );

sl.putConstraint(SpringLayout.WEST, btn2,500, SpringLayout.WEST,p2 );
sl.putConstraint(SpringLayout.NORTH,btn2,300,Sprin gLayout.NORTH,p2 );

tp.addTab("COmpany Info",null,p2,"Company Information");
f.setSize(1024,738);
f.setResizable(false);
f.setVisible(true);
btn1.addActionListener(this);
}
public static void main(String z[])
{
MultiPanel mp=new MultiPanel();
mp.dis();
}

public void actionPerformed(ActionEvent ae)
{
Object obj=ae.getSource();
if(obj==btn1)
{
try
{
String str=pf.getText();
String arr[] = {"montu","shenu","lala"};
if((str.equals(arr[0]))||(str.equals(arr[1]))||(str.equals(arr[2])))
{
/*Here i want Tabbed pane( tp) to be Visible and panel_1 ( p1) to be invisible */
}
else
{
JOptionPane.showMessageDialog(p2,"Invalid Password");
}
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(p2,"Exp Caught");
}
}
}
}