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

Switching between synth and other L&F by loading Synth XML twice throw Exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs

      Switching between Metal L&F and Synth L&F by Loading the Synth XML
      file more than once throws Exception.
      *********************************************
      java.lang.NullPointerException
              at javax.swing.plaf.synth.SynthLookAndFeel.paintRegion(SynthLookAndFeel.java:345)
              at javax.swing.plaf.synth.SynthLookAndFeel.update(SynthLookAndFeel.java:309)
              at javax.swing.plaf.synth.SynthRootPaneUI.update(SynthRootPaneUI.java:76)
              at javax.swing.JComponent.paintComponent(JComponent.java:543)
              at javax.swing.JComponent.paint(JComponent.java:810)
              at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4593)
              at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4546)
              at javax.swing.JComponent._paintImmediately(JComponent.java:4490)
              at javax.swing.JComponent.paintImmediately(JComponent.java:4293)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:214)
              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.NullPointerException
              at javax.swing.plaf.synth.SynthButtonUI.getPreferredSize(SynthButtonUI.java:276)
              at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
              at java.awt.FlowLayout.layoutContainer(FlowLayout.java:437)
              at java.awt.Container.layout(Container.java:1357)
              at java.awt.Container.doLayout(Container.java:1347)
              at java.awt.Container.validateTree(Container.java:1429)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validate(Container.java:1404)
              at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:353)
              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:116)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:214)
              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.NullPointerException
              at javax.swing.plaf.synth.SynthButtonUI.getPreferredSize(SynthButtonUI.java:276)
              at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
              at java.awt.FlowLayout.layoutContainer(FlowLayout.java:437)
              at java.awt.Container.layout(Container.java:1357)
              at java.awt.Container.doLayout(Container.java:1347)
              at java.awt.Container.validateTree(Container.java:1429)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validate(Container.java:1404)
              at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:353)
              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:116)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:214)
              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)
       ********************************************

      Steps to Reproduce:
      ---------------------
      a)Compile all attached ".java" files.
      b)Run attached "JButtonExample.java" with "Button.xml"
      By Default Look and Feel is Synth

      Program runs in Following Sequence.
      1)After "Thread.sleep(4000)" Background color of "Button1" changes to "pink".
      2)After "Thread.sleep(4000)" L&F changes to Metal Look and Feel.
      3)After "Thread.sleep(4000)" we load the Synth XML File again and change
      the L&F to Synth which throws the exception on Console,
       but Look and Feel changes to Synth Again whereas Background color of "Button1" still "pink" which should be
      "yellow" as per the defination in "Button.xml" file. It gets changes only after clicking on "Button1"

      Note:If we comment out "laf.load(JButtonExample.class.getResourceAsStream(xmlFile),JButtonExample.class);"
      from "JButtonExample.java" at line 33 then there is no Exception on
      Console but Background color problem for "Button1" still exist.

            svioletsunw Scott Violet (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: