Thanks Morton,
I altered the logic so it only updated the JTextPane once, rather than
after each cycle of 'loop2'.
It appears that 'JTextPane.setText(report)' is taking several minutes to
execute........ (I'm running the 'app' under JDev..)
Thanks for the suggestions.
Bill
- I'll amend it to use string buffers tonight...
- amend it to produce more diagnostics - length of final report etc etc
=========================================
pseudo-code
string report = "";
loop1 for x = 1 to 50
loop2 for y = 1 to 50
report = report + next-report-line (next-report-line will be
about 300 characters on average)
end-loop2
// JTextPane.setText(report); // commented out the code here -
and moved it to the end.
end-loop1
JTextPane.setText(report); // this took about 2 or 3 minutes.......
==================================
Post by wfsHi Tom,
the program seems to 'hang'....
As it had been a long day, I called it quits at that point. I'll look
at it tonight after work.
Bill
(a COBOL programmer by day, by night a java newbie...)
=========================================
pseudo-code
string report = "";
loop1 for x = 1 to 50
loop2 for y = 1 to 50
report = report + next-report-line (next-report-line will be
about 300 characters on average)
end-loop2
JTexpPane.setText(report);
end-loop1
Post by Thomas HawtinPost by wfsDoes anyone know the maximum length of a string for
JTextPane.setText(string) ?
It should be around 2,000,000,000 characters. More likely it will be
dependent on available memory.
Post by wfsI'm attempting to generate an html report for viewing in a JTextPane.
HTML will take more memory. Swing text is decidedly suboptimal.
Post by wfsIt appears to work fine for small reports (strings around 100,000
characters), but appears to have problems with larger strings (maybe
around 1+ meg). (lost my db connection so will have to wait until
tomorow to narrow down the size it starts to 'break' )
What do you mean by "problems"?
Local databases and unit testing can be very useful.
Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/