While debugging an applet, I noticed that the LookAndFeel used by the Java Console is initialized several times when it first appears. This seems wasteful, and could increase applet startup time on systems where the Java Console is configured to always be shown.
Here are the stack traces:
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1158)
at javax.swing.plaf.basic.BasicLookAndFeel.initialize(BasicLookAndFeel.java:117)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:440)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:477)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1170)
at javax.swing.UIManager.initialize(UIManager.java:1257)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1245)
at javax.swing.UIManager.getLookAndFeel(UIManager.java:407)
at com.sun.deploy.util.DeployUIManager.setLookAndFeel(Unknown Source)
at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
at sun.plugin.JavaRunTime$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1158)
at javax.swing.plaf.basic.BasicLookAndFeel.uninitialize(BasicLookAndFeel.java:128)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:434)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:481)
at com.sun.deploy.util.DeployUIManager.setLookAndFeel(Unknown Source)
at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
at sun.plugin.JavaRunTime$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1158)
at javax.swing.plaf.basic.BasicLookAndFeel.initialize(BasicLookAndFeel.java:117)
at com.sun.java.swing.plaf.windows.WindowsLookAndFeel.initialize(WindowsLookAndFeel.java:104)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:440)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:481)
at com.sun.deploy.util.DeployUIManager.setLookAndFeel(Unknown Source)
at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
at sun.plugin.JavaRunTime$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1158)
at javax.swing.plaf.basic.BasicLookAndFeel.uninitialize(BasicLookAndFeel.java:128)
at com.sun.java.swing.plaf.windows.WindowsLookAndFeel.uninitialize(WindowsLookAndFeel.java:1677)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:434)
at com.sun.deploy.util.DeployUIManager.restoreLookAndFeel(Unknown Source)
at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
at sun.plugin.JavaRunTime$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1158)
at javax.swing.plaf.basic.BasicLookAndFeel.initialize(BasicLookAndFeel.java:117)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:440)
at com.sun.deploy.util.DeployUIManager.restoreLookAndFeel(Unknown Source)
at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
at sun.plugin.JavaRunTime$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
(WRT the line numbers in the stack trace, this was run with the 1.5.0_08 plugin and an instrumented rt.jar from 1.5.0_09. The problem also happens with 6.0).