Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #211

Re: Problem - cannot disp

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Jeff" <jeff@THRWHITE.remove-dii-this>
Subject Re: Problem - cannot disp
Message-ID <1164684060.416689.67220@45g2000cws.googlegroups.com> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <1164633179.048475.310460@j44g2000cwa.googlegroups.com>
References <1164633179.048475.310460@j44g2000cwa.googlegroups.com>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 61
Date Wed, 27 Apr 2011 15:26:14 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917974 96.60.20.240 (Wed, 27 Apr 2011 10:26:14 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:26:14 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:211

Show key headers only | View raw


  To: comp.lang.java.gui

dtsignopoulos@gmail.com wrote:
> There seems to be a problem with processing and inserting large (>2000)
> amounts of data into jtable.
>
> I read single rows from a database, do some processing and use
> insertrow() to feed them to jtable. They get to be displayed (UI) as
> soon ALL rows are done and over with, whereas the desired functionality
> is to be displayed as soon as they are entered (row by row).
>
> Need help as this is turning up to take too much time to figure out.
> Have tried several approaches with no luck.
>
> Some code is listed below:
>
> //  Create staff
>   DefaultTableModel model_matrix = new DefaultTableModel();
>   JScrollPane jScrollPane_matrix = new JScrollPane();
>   JTable jTable_matrix = new JTable(model_matrix) {
>     public boolean isCellEditable(int rowIndex, int vColIndex) {
>       return false;
>     }
>
> // Add some columns
>       model_matrix.addColumn("Timestamp");
>       model_matrix.addColumn("hpic");
>
> //Insert rows
> while (more db rows...){
>             read row...
>             process row...
>             //insert row
>             i = model_matrix.getRowCount();
>             model_matrix.insertRow(i, new Object[] {timestamp, HPIC});
>             model_matrix.fireTableRowsInserted(i,i); setSelectedRow(i);
>
> }
>
> Need help, thanxs

Back to the original question.....(multi posting is a problem, deserves
a mention, but should not be the only response to the question...)

A couple ideas.

The problem of taking too much time to load can be shortened by
limiting the number of rows loaded. You have a table model that is
loading far more data than will be displayed. With a little coding you
can load a limited subset, sliding that subset along depending on the
user needs.

Alternative - fool the user. You probably display about 20 rows. Load
50 into the tablemodel and display. In the meantime load the 2000 into
a second table model, then switch table models. A kludge, certainly,
but it gives the user something to look at while you load the remainder.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Problem - cannot display "dtsignopoulos" <dtsignopoulos@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: Problem - cannot disp "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: Problem - cannot disp "dtsignopoulos" <dtsignopoulos@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: Problem - cannot disp "Jeff" <jeff@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: Problem - cannot disp "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: Problem - cannot disp "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
    Re: Problem - cannot disp "dtsignopoulos" <dtsignopoulos@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: Problem - cannot disp "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000

csiph-web