This content has been marked as final. Show 9 replies
there is a users group for folk who works with Forte/Netbeans, www.netbeans.org
It is better to ask there.
Are you sure that jInternalFrame1 is not null when you try to execute that statement?
at javax.swing.JInternalFrame.setMaximum(JInternalFrame.java:890)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.
I don't know how you would "associate" a JDesktopPaneDrClap is absolutely right here, you have to add JInternalFrame to desktop:
with a JInternalFrame, but possibly if you failed to
do that, then references to the JDesktopPane would
fail with a NullPointerException.
JDesktopPane desktop = new JDesktopPane(); desktop.setLayout(null);
Before ver. 1.3 you could get away without desktop Since ver.1.3.0 it is mandatory.
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.
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 ^_^
your too lasy to look.
Just use the following lines to get the screen size.
this way you should be able to allways have the screenSize.
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setSize(screenSize);
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.
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" ?