Ralph Kar wrote: > Hi all, [...] > The problem arises when I want to > implement isRowVisible() (which itself needs to be called by > TableModel.getRowCount()). This method needs to go over all columns that > have filters attached to them, get their cell values and apply the filter. > This means I need to call TableModel.getValueAt() from that method. > TableModel.getValueAt() requires the columnIndex as parameter. I am unable > to determine this parameter. TableModel.getColumnCount() only returns the > number of columns but not the actual indices. Those do not necessarily be > sequential from 0..n.
Ralph, If a TableModel has a columnCount of n, the indices are always 0..n-1. The headings displayed in the table may be something totally different. That information is in the columnIdentifiers in the TableColumnModel. Also, the JTable itself (the view) keeps a separate set of indices because the user is allowed to move the columns around. It provides two methods for converting back and forth between view indices and model indices: public int convertColumnIndexToModel(int viewColumnIndex) - Maps the index of the column in the view at viewColumnIndex to the index of the column in the table model. public int convertColumnIndexToView(int modelColumnIndex) - Maps the index of the column in the table model at modelColumnIndex to the index of the column in the view. In the common case, the view indices and model indices are the same. Evan McLain junquemale -at- yahoo.com _______________________________________________ Advanced-swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/advanced-swing
