By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,277 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,277 IT Pros & Developers. It's quick & easy.

Idiom for Swing apps with the "new" thread-safety concern?

P: n/a

I have decided to look again at Java after a *really* long break. While
browsing through the Swing tutorials [1], I noticed that the basic
skeleton of the demo applications had something new. There is now a
concern with thread-safety which is illustrated by the use of the
SwingUtilities.invokeLater() method for the GUI manipulation code.

In the demos, the private static method which is responsible for setting
up the GUI (createAndShowGUI) uses local instances in order to create
the main window and other Swing components as opposed to having the user
class actually extend JFrame and contain references to its child
components (JLabel, JButton, etc.). Is this how it should be done now?
What about having easy access to the frame's components? In case
extending from JFrame is still a current practice, could anyone describe
the idiom for it, if any? In other words, what would a basic Swing
application with a user class extending JFrame and the thread-safety
concern in place look like?


Thank you,

Ney André de Mello Zunino
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.