Java Forum / GUI / November 2006
Problem - cannot display rows correctly in jTable
dtsignopoulos@gmail.com - 27 Nov 2006 13:12 GMT 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
Andrew Thompson - 27 Nov 2006 13:51 GMT > There seems to be a problem with .. ..multi-posting? Yes. Terrible, isn't it?
Please don't be part of the problem.
(X-post to c.l.j.p./g., w/ f-u to c.l.j.g.)
Andrew T.
dtsignopoulos@gmail.com - 27 Nov 2006 14:09 GMT Ο/Η Andrew Thompson έγραψε:
> > There seems to be a problem with .. > [quoted text clipped - 5 lines] > > Andrew T. Thank you for shedding light into the problem.
Andrew Thompson - 27 Nov 2006 14:21 GMT > Ï/Ç Andrew Thompson Ýãñáøå: > > > There seems to be a problem with .. > > > > ..multi-posting? Yes. Terrible, isn't it? > > > > Please don't be part of the problem. ...
> Thank you for shedding light into the problem. You're welcome. ...*anytime*.
Andrew T.
dtsignopoulos@gmail.com - 27 Nov 2006 16:46 GMT Andrew, please try to be part of the solution, since you are rather chatty I am sure you can get it together should you decide to try. Be clear on what you say instead of trying to show how smart or not you are. In any case, if you have nothing to add to the issue posted please move along. Thanx.
Ian Wilson - 27 Nov 2006 17:44 GMT > Andrew, please try to be part of the solution, since you are rather > chatty I am sure you can get it together should you decide to try. Be > clear on what you say instead of trying to show how smart or not you > are. In any case, if you have nothing to add to the issue posted please > move along. Thanx. Maybe you are unaware of the meaning of multi-posting, which is what Andrew's comment was about.
If so, you might find this useful: http://www.cs.tut.fi/~jkorpela/usenet/xpost.html
P.S. Andrew, I guess you have some reason's for not including such a link in your responses to multi-posters?
dtsignopoulos@gmail.com - 27 Nov 2006 19:09 GMT Ο/Η Ian Wilson έγραψε:
> > Andrew, please try to be part of the solution, since you are rather > > chatty I am sure you can get it together should you decide to try. Be [quoted text clipped - 10 lines] > P.S. Andrew, I guess you have some reason's for not including such a > link in your responses to multi-posters? Thanx Ian, indeed I was not aware of the meaning of multi-posting and yes I multi-posted the problem letting the pressure for a solution take over 4 me.
Andrew Thompson - 28 Nov 2006 04:32 GMT ....
> P.S. Andrew, I guess you have some reason's for not including such a > link in your responses to multi-posters? - Time (not enough) - Volume (too many) - Patience (0)
My initial post is a short challenge.
What the OP does in response to that challenge is entirely their own business. Responses can range from .. - "What's multi-posting?" to - "If you can't help, shut up!" to - "I have a perfect right - how dare you #$@ (..rant)" to.. - "Sorry - will not happen again." - silence and never hear from the poster again.
If the poster follows options 1 or 4, I might be brought back around to the technical point - and actually reading their post/question, otherwise (shrugs) it is no skin off my nose.
Having said that. It did not occur to me that the OP would respond as he initially did, when he did not understand what multi-posting was. But then again 'not my problem'.
Andrew T.
Andrew Thompson - 28 Nov 2006 05:05 GMT > .... > > P.S. Andrew, I guess you have some reason's for not including such a [quoted text clipped - 3 lines] > - Volume (too many) > - Patience (0) Ohhh.. and what I keep forgetting to add is - that ..
My short (sharp) messages to those who make the mistake of posting to more than one group, are more for the benefit of the people who provide answers, but are unable/willing to spend their time assisting multi-posters.
I am pretty sure those people don't need a link on multi-posting, ..though if they are feeling generous enough, they might pop that link in to the thread, as you did.
dtsignopoulos@gmail.com - 29 Nov 2006 11:02 GMT Andrew, (urgently) please show some respect for the poster who has asked you to move along. Thanx.
Andrew Thompson - 29 Nov 2006 11:33 GMT > Andrew, (urgently) please show some respect for the poster who .. Who?
>...has asked you to move along. Nobody has (unless you are foolish enough to try!).
>...Thanx. dtsignopoulos (urgently) please stop imagining things.
As a tip. The single thing that would be most likely to stop me making further (non-technical) posts to this thread, and encourage others who feel the same way, to contribute, is a statement from you to the effect that 'it will not happen again'.
Rereading all the posts you have made, I do not see that simple assurance, and until I do, I am .. 1) presuming that you have every intention of multi-posting in future. 2) therefore deserve /no/ further help.
So, your call..
Andrew T.
dtsignopoulos@gmail.com - 29 Nov 2006 11:00 GMT Andrew, show some respect for the poster who has asked you to move along. Thanx.
steve - 29 Nov 2006 22:24 GMT > Andrew, show some respect for the poster who has asked you to move > along. Thanx. you are not helping by replying and giving credence to his posting, Ignore & move along.
back to your question.
1. do not try to do 2000 items into a jable, it is confusing to the user. 2. read a % of (don't get silly and read 10's of thousands of rows)the required data from the database into a vector.
tie the Jtable to the vector & do the processing.
Do not read a row , process & display. It will bury your app, your network & your database server.
Steve
Jeff - 28 Nov 2006 03:57 GMT > There seems to be a problem with processing and inserting large (>2000) > amounts of data into jtable. [quoted text clipped - 33 lines] > > 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.
Andrew Thompson - 28 Nov 2006 04:22 GMT ...
> Back Back where?
>..to the original question.. Which *one*?
>......(multi posting is a problem, deserves > a mention, but should not be the only response to the question...) It was not the only answer. A technical (and in 99% probablility - correct) answer* has already been provided... on the *original* question on c.l.j.p.
* I recommend you check it out, if you can locate it. ;)
Andrew T.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|