Reputation: 2454
I've my pasted my source code here. The idea is to collect error messages and warnings in an application where each message is a paragraph with each paragraph describing parts of text with attributes. No matter, what I do the textpane would not display any text - I guess I have got something basic going wrong here. I can use some thoughts - thanks in advance, guys.
Upvotes: 1
Views: 154
Reputation: 109815
1) you have got issue with Concurency, Swing is single threaded all changes from background task should be invoked EDT,
2) better would be initialize those code from Swingworker or Runnble#Thread,
3) if you don't want to solve that your GUI will be unresponsive or freeze durring this task, then wrap output to the Document
inside invokeLater
Upvotes: 3
Reputation: 52185
All GUI changes need to be made through the use of the SwingUtilities.invokeLater method. This will place what you need on the EDT which then executes and displays your text on the screen.
Upvotes: 3