This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I've created a jframe with a jtextpane and more controls. I must execute a threat and in these thread I would like to update the jtextpane but it gives an error because the jtexpanel cannot be resolved.
Could you help me please?
Thanks and sorry for my english!
If you want to update a Swing component from a background thread I suggest you look at SwingWorker because as Darryl has already said you need to call Swing methods on the EDT and not from your background thread. SwingWorker provides a mechanism to handle this type of situation.
As for why you are getting the error, it's because lblNewLabel is not declared in your Thread class and you are using it as if it is a local/instance variable.
Joined: Mar 10, 2011
But... I can declare other time the jlabel to can use it?
Joined: Aug 07, 2007
Sorry, I don't understand what you are trying to say.