My JTextArea content is not refreshed, any ideas suggestions

Hi, I have a swing application which contains two text areas, during some process I print information in the textareas but information only appears once the "do while" is finished. Also I call a pause() which only is supposed to pause between each line but as I said the text area is only filled once the loop is over � thanks in advance for any good suggestions.

do{
outputContent("aaaaa");
pause(3000);
}while(action != null)

�.
pause(long p){
try {
Thread.sleep(p);
catch(InterruptedException e) {
e.printStackTrace();

outputContent(String p)
txtainfo.append(pt);
txtainfo.append("\n\r");
txtanotify.append(p);
txtanotify.append("\n\r");

All the events in Swing are registered with an Event Queue.
The queue dispatches events one by one. Components continues adding events in Queue and Queue continues dispatching events one by one. Repaint is one of that event. When a component think to repaint itself, it adds PaintEvent in Queue and Queue dispatches the event on it's required time.
In your case on each append the PaintEvent is added in the Queue but the thread is slept so after all appends all the paint events are fired one by one.
If you run your do-while loop into a thread then this thing will not happen as your new thread will sleep rather than main thread. So you can consider following:
new Thread(){
public void run(){
do{
// write content and pause
} while();
}.start();
May this help you.
Regards,

Similar Messages

Maybe you are looking for

  • ParseInt gives different values for negative numbers than other browsers

    Is this an known issue? I tested in Safari 4 beta (528.16), don't know about other releases. parseInt(-0.5) in Safari returns -1, while Chrome 3, Opera 10 and Firefox 3.5 returns zero. How can I workaround this?

  • BEx Analyzer - Hiding infocubes/multiproviders from querying

    Hello, We are trying to deny the ability of users to query directly against multiproviders/infocubes/DSO's in BEx Analyzer.  We recently upgraded to 7.3 and have migrated users to 7.x analyzer, but we want to eliminate this specific functionality for

  • 10.6.8 issue - reinstall 10.6.7 or go to Lion?

    I've had problems with the sleep command since installing the 10.6.8 update. The 10.6.8 supplement update didn't help the problem. It takes anywhere from 20 seconds to 50 seconds for my iMac to sleep. I've repaired permissions, and I did the AHT. No

  • SAP workflow documents needed

    Hi, Please provide the documents related SAP workflow.. <THREAD LOCKED. Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] to discover why> Edited by: Mike Pokraka on Sep 5, 2008 12:13 PM

  • Upgrading to InDesign CS4 from International English Upgrade?

    Hi. can I use International English Upgrade from Adobe InDesign CS/CS2/CS3 (Mac) to upgrade my CS2 version of InDesign to Indesign CS4? Any answers would be much appreciated, many thanks! (I am running OS 10.4.11 on a Macbook from 2006) Lollinger