Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetText on textarea

Status
Not open for further replies.

apffal

Technical User
Apr 10, 2004
97
PT
I've created a JDBC application which retrieves data from a local Mysql database and prints results to textfields and the memo (blob) field contents to a textarea in a java form.
When using it in Windows XP, everything works fine.
But, using the same code, in Linux, it takes a long time to print text to the textarea ?
Can someone help ?

That's my relevant code :

txt1 = new TextArea("", 2, 15,
TextArea.SCROLLBARS_VERTICAL_ONLY);
txt1.setEditable(true);
getContentPane().add(txt1);
...................
while (result.next()) {
String text = result.getString(1);
list.add(text);
int x = list.getItemCount();
txt1.setText(list.getItem(x-1));
}

 
Maybe the problem is not in the TextArea but in the local database ...
 
Don't know, but I'm using the same code, the same database, the same driver and even the same computer.
In Windows, I get 100 search results in 4/5 seconds - in Linux, for the same search, 35/36 seconds.
But, in Linux, if I clean results and try another search, the performance is similar to Windows.
Any suggestion ?
 
It doesn't really surprise me that Swing behaves differently from Win32 to Linux, because the graphics and windowing systems are completely and utterly different. You have to remember that while Sun trumpets the "Write once, run anywhere" slogan, in reality Java is completly dependant on OS/native functions when doing file IO, socket IO, graphics & window stuff etc. Hence the slogan should be more "Write once, run anywhere, though it may not behave the same" !



--------------------------------------------------
Free Database Connection Pooling Software
 
So, there is no way of, with my code, getting similar results in both systems, i.e., better performance in Linux ?
 
I agree with sejd, and noy only sun but any JVM vendor.

To solve this problem, I can think in three ways:

- Don't know much about database drivers, but maybe the slow performance is inside the driver (optimized for W32)

- Thread thingie: that behaviour differs in different platforms. Maybe doing database processing in another thread.

- Swing thingie: change to AWT and try

Cheers,

Dian
 
Try to store the results in string array first
Then put the results from array to jtextarea
 
I wouldn'T switch to awt for performance - whoohoho ... (shaking myself) - perhaps to swt (like used in eclipse).

And wouldn't expect the jdbc-driver to be the source of problems.
Try prospers hint would be my hint.

And I don't have performance-problems with jdbc on linux, using postgresql, oracle, hsqldb.

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top