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

NullPointerException when calling javax.swing.JInternalFrame.setMaximum(true)

XMLWordPrintable

    • Fix Understood
    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      java version "1.5.0_08"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
      Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      An exception is thrown when passing true to setMaximum() upon the intialization of my JInternalFrame.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect for the JInternalFrame to initialize the maximize size of the JDesktopPane.
      ACTUAL -
      I get a null pointer exception.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at javax.swing.DefaultDesktopManager.maximizeFrame(DefaultDesktopManager.java:96)
      at javax.swing.plaf.basic.BasicInternalFrameUI.maximizeFrame(BasicInternalFrameUI.java:508)
      at javax.swing.plaf.basic.BasicInternalFrameUI$Handler.propertyChange(BasicInternalFrameUI.java:1529)
      at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
      at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
      at java.awt.Component.firePropertyChange(Component.java:7159)
      at javax.swing.JInternalFrame.setMaximum(JInternalFrame.java:959)
      at MasterFrame.initComponents(MasterFrame.java:32)
      at MasterFrame.<init>(MasterFrame.java:11)
      at MasterFrame$1.run(MasterFrame.java:51)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
      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)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------


      /**
       *
       * @author bgoodin
       */
      public class MasterFrame extends javax.swing.JFrame {
          
          /** Creates new form MasterFrame */
          public MasterFrame() {
              initComponents();
          }
          
          /** This method is called from within the constructor to
           * initialize the form.
           * WARNING: Do NOT modify this code. The content of this method is
           * always regenerated by the Form Editor.
           */
          // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
          private void initComponents() {
              jDesktopPane1 = new javax.swing.JDesktopPane();
              jInternalFrame1 = new javax.swing.JInternalFrame();

              setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
              jInternalFrame1.getContentPane().setLayout(new java.awt.FlowLayout());

              jInternalFrame1.setClosable(true);
              jInternalFrame1.setIconifiable(true);
              jInternalFrame1.setMaximizable(true);
              jInternalFrame1.setAutoscrolls(true);
              try {
                  jInternalFrame1.setMaximum(true);
              } catch (java.beans.PropertyVetoException e1) {
                  e1.printStackTrace();
              }
              jInternalFrame1.setVisible(true);
              jInternalFrame1.setBounds(120, 100, 81, 36);
              jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);

              getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER);

              pack();
          }// </editor-fold>
          
          /**
           * @param args the command line arguments
           */
          public static void main(String args[]) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      new MasterFrame().setVisible(true);
                  }
              });
          }
          
          // Variables declaration - do not modify
          private javax.swing.JDesktopPane jDesktopPane1;
          private javax.swing.JInternalFrame jInternalFrame1;
          // End of variables declaration
          
      }

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

            tr Tejesh R
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: