9 Replies Latest reply on Sep 28, 2001 5:34 PM by 807582

    Is this a bug in the JDK1.3.1 ?

    807582
      I get this error while using this method generated under forte 3.0 CE
      try {
                  jInternalFrame1.setIcon(false);
              } catch (java.beans.PropertyVetoException e) {
                  e.printStackTrace();
              }
      java.lang.NullPointerException
      at javax.swing.DefaultDesktopManager.maximizeFrame(DefaultDesktopManager.java:81)
      at javax.swing.plaf.basic.BasicInternalFrameUI.maximizeFrame(BasicInternalFrameUI.java:607)
      at javax.swing.plaf.basic.BasicInternalFrameUI$InternalFramePropertyChangeListener.propertyChange(BasicInternalFrameUI.java:423)
      at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:161)
      at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:130)
      at javax.swing.JComponent.firePropertyChange(JComponent.java:3208)
      at javax.swing.JInternalFrame.setMaximum(JInternalFrame.java:890)
      at TestInterface.initComponents(TestInterface.java:48)
      at TestInterface.<init>(TestInterface.java:15)
      at TestInterface.main(TestInterface.java:80)

      Has someone any idea of how i can maximise JinternalFrames without using the icon maximisable ??

      In advance thanks.
        • 1. Re: Is this a bug in the JDK1.3.1 ?
          807582
          Hi,

          there is a users group for folk who works with Forte/Netbeans, www.netbeans.org

          It is better to ask there.
          • 2. Re: Is this a bug in the JDK1.3.1 ?
            807582
            Are you sure that jInternalFrame1 is not null when you try to execute that statement?
            • 3. Re: Is this a bug in the JDK1.3.1 ?
              DrClap
              at javax.swing.JInternalFrame.setMaximum(JInternalFrame.java:890)
              at TestInterface.initComponents(TestInterface.java:48)
              What you posted there cannot be the entire contents of the method. According to the stack trace, your initComponents method, at line 48, calls the setMaximum method of some JInternalFrame object. However, the problem remains: Why a NullPointerException? It's possible there is a bug in the JVM, but that theory doesn't get your problem solved if it's true. And it's more likely (MUCH more likely for most of us) that it's a bug in your program. But what could that be? I looked at the API documentation for JInternalFrame.setMaximum and noticed this:

              "A maximized frame is resized to fully fit the JDesktopPane area associated with the JInternalFrame."

              I don't know how you would "associate" a JDesktopPane with a JInternalFrame, but possibly if you failed to do that, then references to the JDesktopPane would fail with a NullPointerException.
              • 4. Re: Is this a bug in the JDK1.3.1 ?
                807582
                I don't know how you would "associate" a JDesktopPane
                with a JInternalFrame, but possibly if you failed to
                do that, then references to the JDesktopPane would
                fail with a NullPointerException.
                DrClap is absolutely right here, you have to add JInternalFrame to desktop:
                JDesktopPane desktop = new JDesktopPane(); desktop.setLayout(null);
                desktop.setOpaque(true);
                desktop.setBackground(Color.lightGray);
                desktop.add(frame);
                setLayeredPane(desktop);
                Before ver. 1.3 you could get away without desktop Since ver.1.3.0 it is mandatory.
                HTH,
                Leo


                • 5. Re: Is this a bug in the JDK1.3.1 ?
                  807582
                  Well i found the problem. It seems the function is placed before the jInternalFrame is
                  added to the jDesktopPane i use. The only solution i have found is calling the function setMaximum() after the initComponent() is called. This way i have no more problems.

                  There is still one problem remaining : the setSelected(true) function seems not to work with the first jInternalFrame displayed in my jDesktopPane.
                  I can find any other solutions than clicking on it to select it. It quite bother me, and i don't know what to do.

                  In Advance thanks.
                  • 6. Re: Is this a bug in the JDK1.3.1 ?
                    807582
                    err.. u guys mentioned about maximising jInternalFrame.. do u know how can i maximise jFrame which is the main app running in windows? as in.. when i start the app. the program will max itself to fit in the windows desktop.

                    is there a solution, or am i just too lazy to look for it? :p
                    do tell, pls.. thanks ^_^
                    • 7. Re: Is this a bug in the JDK1.3.1 ?
                      807582
                      your too lasy to look.

                      Just use the following lines to get the screen size.
                      java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
                      setSize(screenSize);
                      this way you should be able to allways have the screenSize.
                      • 8. Re: Is this a bug in the JDK1.3.1 ?
                        807582
                        err.. the thing is.. using that function, i'm not maximising.. i'm just putting the window size to the dimension of the screen, but the fact is.. its state is not "MAXIMIZED".

                        i can't seem to find the MAXIMIZED state for jFrames. jInternalFrames, yes.. but jFrames, no.

                        : (
                        • 9. Re: Is this a bug in the JDK1.3.1 ?
                          807582
                          oh.. how rude of me.. :p

                          forgot to say thanks hehe.

                          thanks marc! ^_^

                          but.. do u have any ideas how to put the state to "maximized" ?