Talk:Swing (Java): Difference between revisions

Content deleted Content added
Cryptic example: new section
Line 90:
 
What's the Event Dispatch Thread? What's an anonymous Runnable class? Why do I have to go to the Concurrency tutorial to just show a label and a button? What rules changed in 2004? OK I don't really ask these questions, but I doubt that anyone who don't know about Swing will understand something about Swing with the example. Maybe he will understand that Swing is an overcomplicated affair and that he should stay clear of it and use Flex or C# instead ;) I'm kidding because I love to use Swing, but I doubt that in it's current state this example is useful at all, even if it is legit. [[User:Hervegirod|Hervegirod]] ([[User talk:Hervegirod|talk]]) 00:31, 6 November 2009 (UTC)
:Yes this is a bit awkward. However it only requires 4 lines
<pre>
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
....
}});
</pre>
:of standard boiler plate code to get thread safe behaviour. You can miss this out and it will probably work. However, I don't think it would be right to show technically incorrect code and bad practice.
:One way of organising this would be to have a code fragment first with just the Swing bits. Then introducing the threading example later.--[[User:Salix alba|Salix]] ([[User talk:Salix alba|talk]]): 07:34, 6 November 2009 (UTC)