Hi,
I have added up a JTable to a JScrollPane . Now i have a button on clicking it the table is displayed but the problem is when ever i click the button the old rows are not erased and new once are added below
Heres my code
Java Code:
JPanel jp6 = new JPanel();
due = new JButton("Dues");
due.addActionListener(this);
print.setMnemonic(KeyEvent.VK_P);
JPanel viewd = new JPanel();
viewd.add(print);

due.addActionListener(new ActionListener()
{
	public void actionPerformed(ActionEvent e)
	{
			cl.show(panel,"6");
	try
		{
			conn = DriverManager.getConnection("jdbc:odbc:addissue", "library","adeeb");
			ps = conn.prepareStatement("SELECT * FROM expired WHERE days > 15 ORDER BY rollno ASC");
		
			String colnames[] = {"ROLLNO","NAME","BOOK","BOOK ID","ISSUED","PRES_DATE","DAYS"};
			DefaultTableModel model6 = (DefaultTableModel) tab6.getModel();
			model6.setColumnIdentifiers(colnames);
			rs=ps.executeQuery();
			ResultSetMetaData rsmd = rs.getMetaData();
			int colno = rsmd.getColumnCount();
			while(rs.next())
			{
				Object[] row = new Object[colno];
				for(int i=0;i<colno;i++)
				{
					row[i]=rs.getObject(i+1);
				}
				model6.addRow(row);
			}
			tab6.setModel(model6);
			
			}
			
		catch(Exception ce)
		{
			System.out.println(ce);
		}
	
		}
	});

tab6 = new JTable();
jsp6 = new JScrollPane(tab6);
jsp6.setViewportView(tab6);
jsp6.revalidate();
jsp6.repaint();
jp6.setLayout(new BorderLayout());

jp6.add(jsp6);
jp6.add(viewd, BorderLayout.SOUTH);