setBounds(0,0,-1,-1) make a JInternalFrame disappear

Hi all,

I have problem on making a JInternalFrame (searchInvoicePanel) appearing on screen.

I work with Netbeans 5.5 and the form designer automatically generates the searchInvoicePanel.setBounds method to (0, 0, -1, -1), while the normalBounds property on the editor is set to [0, 0, 600, 400].

I have tried to set the searchInvoicePanel.setBounds to the desired dimensions (0, 0, 600, 400) using other IDE and it works fine.

Below there is all the related code.

Any help would be appreciated. Thanks

JInternalFrame searchInvoicePanel =new JInternalFrame ();

JDesktopPane desktopPane =new JDesktopPane();

..

.

desktopPane.setMinimumSize(new java.awt.Dimension(600, 400));

desktopPane.setOpaque(false);

desktopPane.setPreferredSize(new java.awt.Dimension(914, 686));

searchInvoicePanel.setDebugGraphicsOptions(javax.swing.DebugGraphics.LOG_OPTION);

searchInvoicePanel.setVisible(true);

searchInvoicePanel.setParent(this);

searchInvoicePanel.setBounds(0, 0, -1, -1);

desktopPane.add(searchInvoicePanel, javax.swing.JLayeredPane.DRAG_LAYER);

try{

searchInvoicePanel.setSelected(true);

}catch (java.beans.PropertyVetoException e1){

e1.printStackTrace();

}

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) );

java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();

setBounds((screenSize.width-922)/2, (screenSize.height-741)/2, 922, 741);

[2344 byte] By [asimasa] at [2007-11-26 18:50:15]
# 1
> I have tried to set the searchInvoicePanel.setBounds to the desired > dimensions (0, 0, 600, 400) using other IDE and it works fine.then, the simple answer is not to use netbeans.If you have a problem with netbeans, you should post in a netbeans forum
Michael_Dunna at 2007-7-9 6:24:17 > top of Java-index,Desktop,Core GUI APIs...