hey , my question is that suppose we have an application runnig . it has a jlabel with some text and now in some function i change the text by using setText()func and continue with some other stuff in the function , now the text that i changed is not getting painted on the label right away . it waits for the function to end before actually changing it.

is there anyway i can change it rightaway before the function is terminated.

public void somefunc(){

                     label.setText(" new text ");
                     // continue with the func 


                      }

Recommended Answers

All 2 Replies

Perform you function in a Swing Worker Thread, not on the Event Dispatch Thread. I have no time to explain this now, but Google will help.

@jamescherrill - i got it now . thanks for your help :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.