Why not just have the TableModel return a row count of 1 more than the
number of rows of data you've already got.  Then render that row as (say)
column 0 "click here for more ..." and the other columns blank.  To detect
the click use a TableCellEditor but with the getTableCellEditorComponent
method implemented something like:

public Component getTableCellEditorComponent
        (JTable table, Object value, boolean isSelected, int row, int
column) {

    if ((row+1) == table.getModel().getRowCount()
            && column == 0) {
        /* 
         * fetch new data, add to TableModel, and
         * ensure table model fires rows insert
         * event (fireTableRowsInserted method if
         * you subclass AbstractTableModel.
         */
        ...

        //Return null since we don't want to really edit
        return null

    } else {
        /*
         * Do what you're editor need to do for the other
         * cells in this column. Could just delegate to
         * the TableCellEditor this one is replacing
         */
        ...
    }
}

Regards

Dave Wathen
Goldman Sachs Asset Management
3rd Floor, Procession House
55 Ludgate Hill
London EC4M 7JN
+44 (0)20-7774-2998

It is not necessary to understand things in order to argue about them.
(Caron de Beaumarchais)


-----Original Message-----
From: Damijan Sencar [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 7:47 AM
To: [EMAIL PROTECTED]
Subject: JTable and row loading


Hi!

How can I capture an event when user try to select row after last row in
a table (i.e. with cursor)
For example: I got some limited number of customers from a file. When I
walk trough the table to the end, I would like to load next number of
customers from a file.  


Thanx,

Damijan
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to