Hi,
this is the code for the layout as well as for the button listener. I have tried to write the code to get data in table. But i dont see any table on the panel except two text fields and a button which i have add below. More Over when i tried to display the table in another panel without any other component it was successfully seen. Means i dint add any button so that on clicking that i could get the table. But i actually need the button so that i get the table when i click it.
ftf = new JTextField(20);
ftf1 = new JTextField(20);
froll = new JLabel("Roll No");
fname = new JLabel("Name");
find = new JButton("Find");
//tb = new JTable();
//ta = new JTextArea(10,10);
GroupLayout gl5 = new GroupLayout(jp5);
jp5.setLayout(gl5);
gl5.setAutoCreateGaps(true);
gl5.setAutoCreateContainerGaps(true);
gl5.setHorizontalGroup(gl5.createSequentialGroup()
.addGroup(gl5.createParallelGroup(LEADING)
.addComponent(froll)
.addComponent(fname))
.addGroup(gl5.createParallelGroup(LEADING)
.addComponent(ftf)
.addComponent(ftf1)
.addComponent(find, (CENTER))
.addComponent(tb, (CENTER)))
);
gl5.setVerticalGroup(gl5.createSequentialGroup()
.addGroup(gl5.createParallelGroup(BASELINE)
.addComponent(froll)
.addComponent(ftf))
.addGroup(gl5.createParallelGroup(BASELINE)
.addComponent(fname)
.addComponent(ftf1))
.addGroup(gl5.createParallelGroup(BASELINE)
.addComponent(find))
.addGroup(gl5.createParallelGroup(BASELINE)
.addComponent(tb))
);
gl5.linkSize(SwingConstants.HORIZONTAL, ftf, ftf1);
find.addActionListener(new ActionListener()
{

public void actionPerformed(ActionEvent e)
{
Vector colnames = new Vector();
Vector tbdata = new Vector();
try
{
conn = DriverManager.getConnection("jdbc dbc:addissue", "library","adeeb");
String rollno = ftf.getText();
int roll = Integer.parseInt(rollno);
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM addissue WHERE rollno="+roll);
ResultSetMetaData md = rs.getMetaData();
int col = md.getColumnCount();

for (int i=1;i<=col;i++)
{
colnames.addElement(md.getColumnName(i));
}
while(rs.next())
{
Vector row1 = new Vector(col);
for(int i=1;i<=col;i++)
{
row1.addElement(rs.getObject(i));
}
tbdata.addElement(row1);
}
rs.close();
stmt.close();
conn.close();
tb = new JTable(tbdata,colnames);
JScrollPane jsp1 = new JScrollPane(tb);
}

catch(Exception ce)
{
System.out.println("Exception"+ce);
}
}
});
So any body please help.