Link to home
Start Free TrialLog in
Avatar of favelill
favelill

asked on

Swing refresh textArea

Hi everybody,

I have a code like this:

public void disableResponse() {
   taResultArea.setText("Sending...");
   taResultArea.setEnabled(false);
   repaint();
}
      
public void sendRequest() {
   // Here I send something to a remote host
   // ...
   taResultArea.setText(response);
   taResultArea.setEnabled(true);
}

And in the action of the button I call both methods, first disableResponse, then sendRequest. Of course the above code doesn´t work, because between the disableResponse call and the sendRequest call I don't allow java to do the repaint work.

I thought the repaint call was enough to do the work... I was wrong. I don't want to put the management of the textArea in a thread. Is there a work around of this without the using of threads?

Best regards,

favelill
ASKER CERTIFIED SOLUTION
Avatar of tdisessa
tdisessa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial