I'm looking for a class that would extend the JTable class, so that this new
class allows hiding of rows. What I mean is that sometimes I would some
rows not to be displayed, but I don't want to have to delete all the data in
the table, and then refilling it.
Thanks in advance
Override an own version of a TableModel which keeps a flag associated with
each row (visible/invisible) and only "shows" rows that have the flag set.
This has the effect that your model still contains all the data, but that it
simply doesn't show all of it to the view.
Johannes.
john doe wrote in message <7edm9c$14s$1...@bcarh8ab.ca.nortel.com>...
How exactly does the TableModel/JTable display the rows though? I haven't
seen anything in the documentation that shows how it is done. Since, I'd
only want to show the rows that have the flag set, I would have to modify
something somewhere to tell the TableModel/JTable to display these
"selected" rows only, but I really don't know where to look...
Thanks again
Johannes Hubert wrote in message <7ef0da$l0i$1...@minox.tripnet.se>...
john doe wrote:
--
mark weaver
http://www.geocities.com/~velosapiens
a source of important and interesting information for mountain bikers
Thanks anyways.
mark wrote in message <370B80F4...@abtcorp.com>...
If you want to hide certain rows or columns, the first thing to do is to
make those routines smart enough to skip those rows and columns the next
time JTable calls them.
E.g. if you have 121 rows of data and you want to hide row 41,
getRowCount will have to tell JTable there are 120 rows. Similarly when
getValueAt gets called for any row after row 40, it should return the
row after in the underlying data (array, resultset etc).
The second thing you have to do is tell JTable about the rows that are
deleted (from the view) or added to it. There are a whole series of
fireTablexxxyyy() methods, such as fireTableRowsDeleted( r1, r2) to
delete a range of rows.
Sun has a very good tutorial on this. Look for the BINGO application.
=============
----------------
--
Frans van Duinen (416) 652-8085
Master Programmer Group Inc.
Toronto, Ont.