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

javax.swing.JLayer.addNotify() throws NPE

XMLWordPrintable

      JDK: 7b70+
      Platform: Windows, Solaris

      The following simple code throws NPE:
      ------------------------------------------------------
      import javax.swing.*;
      import java.awt.*;
      public class AddNotify {
          public static void main(String[] args) {
              new JLayer<Button>(new Button()).addNotify();
          }
      }
      ------------------------------------------------------
      On Windows:

      Exception in thread "main" java.lang.NullPointerException: peer
      at sun.awt.windows.WButtonPeer.create(Native Method)
      at sun.awt.windows.WComponentPeer.<init>(WComponentPeer.java:719)
      at sun.awt.windows.WButtonPeer.<init>(WButtonPeer.java:60)
      at sun.awt.windows.WToolkit.createButton(WToolkit.java:331)
      at java.awt.Button.addNotify(Button.java:177)
      at java.awt.Container.addNotify(Container.java:2623)
      at javax.swing.JComponent.addNotify(JComponent.java:4731)
      at AddNotify.main(AddNotify.java:6)

            Unassigned Unassigned
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: