Google

Saturday, January 17, 2009

Netbeans: How to set JFrame Size in Design View



To be able to resize the JFrame in Design View, you need to
change the Form Size Policy to Generate Resize Code.
The default is Generate pack().

You can do that by selecting the Code Generation Property
as shown in the screen shot above.

However, once you do that, you may find that the JInternalFrame
(the MDI Child) may not align properly inside the Parent Frame.
To solve this problem, modify the Parent code:

private void startrevisionMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
StartrevisionFrame startexamframe = new StartrevisionFrame();
desktop.add(startexamframe);
startexamframe.setLocation(0, 0);
startexamframe.setVisible(true);
}

The important method is:

startexamframe.setLocation(0, 0);