how to create several tabs dynamically?
===

I want to connect databases and show their query panel in separate tabs...tabs should be created when the connection is made(see the below codes) by calling the method CreatePanel. 

Button for connection:
 
    jButton2 = new JButton();
				getContentPane().add(jButton2);
				jButton2.setText("Connect");
				jButton2.setBounds(229, 50, 90, 29);
				jButton2.setVisible(false);
				jButton2.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						LinkedFrame inst2 = new LinkedFrame(inst, true);
						inst2.setLocationRelativeTo(rootPane);
						inst2.setVisible(true);
						if (Connector.getProcessStatue()) {
							// System.out.println(Connector.getProcessStatue());
							CreatePanel(connectionItem);
							jButton2.setVisible(false);
							jButton3.setVisible(true);
							tabbedPane.setVisible(true);
							setSize(342, 265);
                                                }

					}
				});
			}

 Codes of method CreatePanel:

    	public static ArrayList<JPanel> CreatePanel(String i){
		if (tabbedPane == null)
			tabbedPane = new JTabbedPane();

		JPanel inst1 = new JPanel();
		String tabTitle =String.format("Query Panel %d",item+1);
		inst1.setSize(310, 109);
		inst1.setBounds(8, 87, 310, 109);

		inst1.setBorder(BorderFactory
				.createTitledBorder(BorderFactory.createEtchedBorder(),tabTitle));
			JTextPane jTextPane1 = new JTextPane();
			inst1.add(jTextPane1);
			inst1.setVisible(true);
			jTextPane1.setBounds(8, 54, 294, 49);
			tabbedPane.addTab(connectionItem, null, inst);
		
			JLabel jLabel3 = new JLabel("Employee ID", SwingConstants.LEFT);
			inst1.add(jLabel3);
			jLabel3.setBounds(12, 26, 85, 16);
			jLabel3.setVisible(true);
		
			JButton jButton4 = new JButton("Search");
			inst1.add(jButton4);
			jButton4.setVisible(true);
			jButton4.setBounds(220, 19, 82, 29);
		
			JTextField jTextField2 = new JTextField();
			inst1.add(jTextField2);
			jTextField2.setVisible(true);
			jTextField2.setBounds(109, 19, 99, 30);
			
		getContentPane.add(tabbedPane);
		tabbedPane.setVisible(false);
		System.out.println(item);
		item++;
		return info;
	}

but unfortunately the tabbedpanel is not displayed.please help me to find the problem.
