Thread View: borland.public.jbuilder.java.swing
3 messages
3 total messages
Started by dtsignopoulos
Mon, 27 Nov 2006 12:30
Problem - cannot display rows correctly in jTable
Author: dtsignopoulos
Date: Mon, 27 Nov 2006 12:30
Date: Mon, 27 Nov 2006 12:30
37 lines
2358 bytes
2358 bytes
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
Re: Problem - cannot display rows correctly in jTable
Author: Kevin Dean [TeamB]
Date: Mon, 27 Nov 2006 15:23
Date: Mon, 27 Nov 2006 15:23
26 lines
2032 bytes
2032 bytes
dtsignopoulos@gmail.com wrote: > 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). The problem is that you're processing the rows in the same thread in which the rows are to be displayed. You need to do this kind of processing in the background; your UI should then keep up with the processing just fine. Here's a link to get you started: http://java.sun.com/docs/books/tutorial/uiswing/concurrency/ -- Kevin Dean [TeamB] Dolphin Data Development Ltd. http://www.datadevelopment.com/ NEW WHITEPAPERS Team Development with JBuilder and Borland Enterprise Server Securing Borland Enterprise Server http://www.datadevelopment.com/papers/index.html Please see Borland's newsgroup guidelines at http://info.borland.com/newsgroups/guide.html
Re: Problem - cannot display rows correctly in jTable
Author: dtsignopoulos
Date: Mon, 27 Nov 2006 16:51
Date: Mon, 27 Nov 2006 16:51
4 lines
1456 bytes
1456 bytes
Thanx Kevin. As I write this I have the tutorial waiting to be read. I am relatively new in java but I am determined to go ahead. Will post the outcome of this (worked / didn't work).
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads