FULL PRODUCT VERSION : java version "1.6.0-rc" Java(TM) SE Runtime Environment (build 1.6.0-rc-b98) Java HotSpot(TM) Client VM (build 1.6.0-rc-b98, mixed mode) A DESCRIPTION OF THE PROBLEM : The first example given on the Swing package documentation under the heading "Swing's Threading Policy" does not compile. A constructor is called with an argument String[], but no such constructor exists. Both examples are missing the import of javax.swing.SwingUtilities. In my opinion the examples would be clearer if they did not attempt to deal with command line arguments or constructing other objects (MyApp). Also the access modifiers are overly public and java.awt.EventQueue.invokeLater is preferrable to the obsolete version in the SwingUtilities dumping ground. So a clearer, correct example would be: class MyApp { private static void show() { // Show the UI. } public static void main(final String[] args) { // Schedule a job for the AWT event-dispatching thread: // creating and showing this application's GUI. java.awt.EventQueue.invokeLater(new Runnable() { public void run() { show(); } }); } } REPRODUCIBILITY : This bug can be reproduced always.
|