This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have a special RepaintManager installed in my NetBeans platform-based application that checks for calls to Swing components that are not from the Event Dispatch Thread. See the code at https://swinghelper.dev.java.net/ and a related blog entry at http://weblogs.java.net/blog/alexfromsun/archive/2006/02/debugging_swing.html. When I turn this on, I get two thread violations on application startup, one from TopSecurityManager.makeSwingUseSpecialClipboard and one from ContextMenuWarmUpTask.run. See attachments for the full stack trace.
Created attachment 55673 [details] Stack trace for EDT violations
Hmm, I understand how these violations occured, but I don't know what we can do with them and whether they are potentially dangerous or not. Remove menu warm-up completely? i wouldn't want to do it. But wait, components are not a part of AWT live hierarchy yet - they are just being created. I thought that it is legal to create Swing components outside EDT...
I am no expert on the subject, but see the blog entry I linked to in the submission and also http://java.sun.com/docs/books/tutorial/uiswing/concurrency/initial.html: "Why doesn't the initial thread simply create the GUI itself? Because almost all code that creates or interacts with Swing components must run on the event dispatch thread."
well, the article says *almost* all code:) anyway, in both cases the violations were caused by a call to repaint() method which should be pretty safe to call outside EDT, imho
*** Issue 128582 has been marked as a duplicate of this issue. ***
I agree with saubrecht and I think that debug repaint manager is not written correctly here. "Why doesn't the initial thread simply create the GUI itself?" - we can't do it for performance reasons. We create GUI in other threads to speedup startup, it is very important in such big app like NetBeans IDE. I would suggest to modify debug repaint manager from SwingHelper to report EDT violation only when component that is being repainted exists in live AWT hierarchy (isDisplayable == true) - that would be real and potentially dangerous EDT violation IMHO. Closing as WONTFIX, however it would be good if some real Swing expert can confirm or deny what I'm saying.