NullPointerExcpetion when trying to maximinze JInternalFrame
"Brandon Goodin" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
Hey All,
Whenever I select the maximize checkbox in the property dialog for a
JInternalFrame and then run my App i get a NullPointerException. The app is
making use of the Platform only and not the full Netbeans IDE. It looks like
the frame's parent bounds are null. As per below the code is blowing on this
call f.getParent().getBounds();. Forgive me if i'm being a complete fool.
But, any help would be appreciated.
Platform: Windows 2k
JDK: 1.5.0_08
Netbeans: 5.5 rc1
The Exception occures after this portion of code calls up into the swing
api...
private void initComponents() {
dialogDesktopPane1 = new javax.swing.JDesktopPane();
dialogInternalFrameBean1 = new
org.openfcm.ircme.DialogInternalFrameBean();
dialogDesktopPane1.setAutoscrolls(true);
try {
dialogInternalFrameBean1.setMaximum(true); // NULL POINTER AFTER
THIS
} catch (java.beans.PropertyVetoException e1) {
e1.printStackTrace();
}
...
}
The actual Exception happens here in javax.swing.DefaultDesktopManager:
...
/**
* Resizes the frame to fill its parents bounds.
* @param f the frame to be resized
*/
public void maximizeFrame(JInternalFrame f) {
if (f.isIcon()) {
try {
// In turn calls deiconifyFrame in the desktop manager.
// That method will handle the maximization of the frame.
f.setIcon(false);
} catch (PropertyVetoException e2) {
}
} else {
f.setNormalBounds(f.getBounds());
Rectangle desktopBounds = f.getParent().getBounds(); // NULL
POINTER HAPPENS HERE
setBoundsForFrame(f, 0, 0,
desktopBounds.width, desktopBounds.height);
}
...
java.lang.NullPointerException
at javax.swing.DefaultDesktopManager.maximizeFrame(
DefaultDesktopManager.java:96)
at javax.swing.plaf.basic.BasicInternalFrameUI.maximizeFrame(
BasicInternalFrameUI.java:521)
at
javax.swing.plaf.basic.BasicInternalFrameUI$Handler.propertyChange(
BasicInternalFrameUI.java:1569)
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 org.openfcm.ircme.DialogTopComponent.initComponents(
DialogTopComponent.java:45)
at org.openfcm.ircme.DialogTopComponent.<init>(
DialogTopComponent.java:27)
at org.openfcm.ircme.DialogTopComponent.getDefault(
DialogTopComponent.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.createFromMethod
(XMLSettingsSupport.java:638)
at
org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.instanceCreate
(XMLSettingsSupport.java:553)
at
org.netbeans.modules.settings.convertors.SerialDataConvertor$SettingsInstance.instanceCreate
(SerialDataConvertor.java:371)
[catch] at
org.netbeans.core.windows.persistence.PersistenceManager.getTopComponentPersistentForID
(PersistenceManager.java:445)
at
org.netbeans.core.windows.persistence.PersistenceManager.getTopComponentForID
(PersistenceManager.java:552)
at org.netbeans.core.windows.PersistenceHandler.getTopComponentForID
(PersistenceHandler.java:354)
at org.netbeans.core.windows.PersistenceHandler.initModeFromConfig(
PersistenceHandler.java:321)
at org.netbeans.core.windows.PersistenceHandler.load(
PersistenceHandler.java:158)
at org.netbeans.core.windows.WindowSystemImpl.load(
WindowSystemImpl.java:45)
at org.netbeans.core.NonGui$3.run(NonGui.java:224)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
EventDispatchThread.java:242)
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)
Thanks,
Brandon