Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6600674

UIManager.setLookAndFeel was failed.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux anchor 2.6.20-1.2962.fc6 #1 SMP Tue Jun 19 18:24:12 EDT 2007 i686 i686 i386 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      I executed Swing program in GNOME environment on Linux.

      UIManager.getSystemLookAndFeelClassName() returns following in GNOME.

      com.sun.java.swing.plaf.gtk.GTKLookAndFeel

      This is valid value.
      I set this value to UIManager.setLookAndFeel().
      So exception was trowm.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Compile and execute following code.

      import javax.swing.UIManager;

      public class Test {
              public static void main(String[] args) throws Exception {
                      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      ACTUAL -
      Finish normally.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initSystemColorDefaults(GTKLookAndFeel.java:1267)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1509)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.access$000(GTKLookAndFeel.java:37)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel$WeakPCL$1.run(GTKLookAndFeel.java:1449)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      Exception in thread "main" java.lang.NullPointerException
              at javax.swing.plaf.synth.SynthLookAndFeel$AATextListener.propertyChange(SynthLookAndFeel.java:793)
              at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
              at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:347)
              at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
              at java.awt.Toolkit.setDesktopProperty(Toolkit.java:1784)
              at sun.awt.SunToolkit.fireDesktopFontPropertyChanges(SunToolkit.java:1698)
              at sun.awt.SunToolkit.setAAFontSettingsCondition(SunToolkit.java:1743)
              at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:119)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initComponentDefaults(GTKLookAndFeel.java:1258)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.getDefaults(GTKLookAndFeel.java:294)
              at javax.swing.UIManager.setLookAndFeel(UIManager.java:537)
              at javax.swing.UIManager.setLookAndFeel(UIManager.java:581)
              at W.main(W.java:17)
      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initSystemColorDefaults(GTKLookAndFeel.java:1267)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1509)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.access$000(GTKLookAndFeel.java:37)
              at com.sun.java.swing.plaf.gtk.GTKLookAndFeel$WeakPCL$1.run(GTKLookAndFeel.java:1449)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.UIManager;

      public class Test {
              public static void main(String[] args) throws Exception {
                      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Call UIManager.getInstalledLookAndFeels() before getSystemLookAndFeelClassName().

      See following.

      import javax.swing.UIManager;

      public class Test {
              public static void main(String[] args) throws Exception {
                      UIManager.getInstalledLookAndFeels();
                      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                peterz Peter Zhelezniakov (Inactive)
                Reporter:
                igor Igor Nekrestyanov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: