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

Nimbus L&F: java.lang.NullPointer Exception throws when extended BaseUI Components

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6u10
    • client-libs

      Have extends some UI Components to add additonal features. With the Nimbus L&F
      the BaseUI is not working in all cases. See the exception below.
      we does not have control over the L&F and this will be a fatal for our customers.
      This must be fix in the BaseUI classes or in the Nimbus L&F defintion.
      Because the problem occur inside of the Sun classes it is inpossible to compensate it.

      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
              at javax.swing.plaf.basic.BasicTabbedPaneUI.rotateInsets(BasicTabbedPaneUI.java:2124)
              at javax.swing.plaf.basic.BasicTabbedPaneUI.getTabAreaInsets(BasicTabbedPaneUI.java:1783)
              at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateTabRects(BasicTabbedPaneUI.java:2528)
              at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateLayoutInfo(BasicTabbedPaneUI.java:2488)
              at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.layoutContainer(BasicTabbedPaneUI.java:2383)
              at java.awt.Container.layout(Container.java:1432)
              at java.awt.Container.doLayout(Container.java:1421)
              at java.awt.Container.validateTree(Container.java:1519)
              at java.awt.Container.validateTree(Container.java:1526)
              at java.awt.Container.validateTree(Container.java:1526)
              at java.awt.Container.validateTree(Container.java:1526)
              at java.awt.Container.validateTree(Container.java:1526)
              at java.awt.Container.validateTree(Container.java:1526)
              at java.awt.Container.validateTree(Container.java:1526)
              at java.awt.Container.validate(Container.java:1491)
              at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:670)
              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:127)
              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)


      Here is the test case for the BasicTabbedPaneUI. The tests for the other basic UI classes are equals.

      import java.awt.Container;
      import javax.swing.*;
      import javax.swing.plaf.basic.*;

      public class TestNimbus {

          public static void main( String[] args ) throws Exception{
              UIManager.setLookAndFeel( "sun.swing.plaf.nimbus.NimbusLookAndFeel" );
              JFrame frame = new JFrame();
              Container cont = frame.getContentPane();
              JTabbedPane tab = new JTabbedPane();
              tab.setUI( new BasicTabbedPaneUI() );
              cont.add( tab );
             
              frame.pack();
              frame.show();

          }

      }

            jasper Jasper Potts (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: