hi ...
i have a form that has a table...
i wanted to add scroll bars to that table but i don't really know how to do it.
can someone help me please??
this is my code for creating the table :
final
String[] colName = { "CPR", "Name", "Address", "Phone", "Sex", "Date OF Birth" };
TableModel pageModel = new AbstractTableModel()
{
public int getColumnCount()
{
return tableData[0].length;
} //getColumnCount
public int getRowCount()
{
return tableData.length;
} //getRowCount
public Object getValueAt(int row, int col)
{
return tableData[row][col];
} //getValueAt
public String getColumnName(int column)
{
return colName[column];
} //getcolName
public Class getColumnClass(int col)
{
return getValueAt(0, col).getClass();
} //getColumnClass
public boolean isCellEditable(int row, int col)
{
return false;
} //isCellEditable
public void setValueAt(String aValue, int row, int column)
{
tableData[row][column] = aValue;
} //setValueAt
}; //pageModel
//-----------------------------------------------------------------------------------------------------
//Create the JTable from the table model:
dataTable = new JTable(pageModel);
//-----------------------------------------------------------------------------------------------------
if (scrollpane != null)
{
scrollpane.setVisible(false);
scrollpane = null;
} //if
scrollpane = new JScrollPane(dataTable);
scrollpane.setVisible(true);
if (inputPanel == null)
makeGUI();
customerPanel.add(scrollpane, BorderLayout.SOUTH);
c.add(tabs);
id.grabFocus();
pack();
repaint();
adupdateTable();
} //try
catch (Exception e)
{
System.out.println("Caught updateTable exception: " + e);
} //catch
} //updatetable
thankxx