tags:

views:

34

answers:

2

When i try to hide the rows in a jTable, the jTable ScrollPanel need to adjust its size to remaining rows and, other components in the Frame also adjust to the change. i.e., there shouldn't be any space between the components and the jTable after hiding the table-rows..

ex: in microsoft excel, when we delete a row, the remaining rows will move upwards to fill the deleted row..

Please help me.. Thank you..

Edited: Used a model that extends AbstractTableModel. Used RowFilter to hide the rows. Problem is even when the rows disapper, the JScrollpane(where the JTable resides) wont get adjusted to the remaining rows..

+1  A: 

Are you trying to hide rows or delete rows? You mention hiding rows in JTable but deleting them in Excel.

The Alchemist
i am trying to hide rows.. excel is just an example for how UI should be..
manidhar mulaparthi
+1  A: 

You can use setPreferredScrollableViewportSize() to resize the scroll pane to the desired multiple of getRowHeight(). You can use validate() "to cause a Container to lay out its subcomponents again" or pack() to cause the Window "to be sized to fit the preferred size and layouts of its subcomponents."

trashgod