All rows not visible in the table.

Hi,

I have created a table, It is displaying finely. But when I add many rows to the table, only 10 rows are visible. I have used Default table model, I am inserting rows into the table at a later stage. I tried many ways, If anybody knows please help me out of it.

model =new DefaultTableModel(columnNames,0)

{

public Class getColumnClass(int columnIndex)

{

Object o = getValueAt(0, columnIndex);

if (o ==null)

{

return Object.class;

}

else

{

return o.getClass();

}

}

};

table =new JTable(model){

public Dimension getPreferredSize(){

returnnew Dimension(300, 300);

}

public Dimension getMinimumSize(){

returnnew Dimension(300, 0);

}

public Dimension getMaximumSize(){

returnnew Dimension(300, 300);

}

};

table.setRowHeight(30);

table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

with Regards,

Gangotri

[2041 byte] By [Gangotri.a] at [2007-11-26 22:38:24]
# 1
Why are you overriding the sizes? Add the table to a scrollpane and set the preferred size of the scrollpane to controll the number of visible rows at one time.
camickra at 2007-7-10 11:50:15 > top of Java-index,Desktop,Core GUI APIs...
# 2
Hi,Thanks a lot it is working.with Regards,Gangotri
Gangotri.a at 2007-7-10 11:50:15 > top of Java-index,Desktop,Core GUI APIs...