GridBagLayout on JDesktop  
Author Message
Thomas Pototschnig





PostPosted: 2005-5-7 18:20:00 Top

java-programmer, GridBagLayout on JDesktop Hi,

I have problems using GridBagLayout for positioning JInternalFrames on a
JDesktop.
For instance, I have 2 JInternalFrames and I neither set the size nor the
preferedSize of the InternalFrame because I thought my JInternalFrames would
get the size from the GridBagLayout-manager but it doesn't work at all.

[...]
desktop = new JDesktopPane();
gbl = new GridBagLayout();
desktop.setLayout(gbl);
content.add(desktop);
[...]
GridBagConstraints gbc1 = makegbc(0, 0, 1, 5);
gbl.setConstraints(treeIFrame, gbc1);
desktop.add(treeIFrame);

GridBagConstraints gbc2 = makegbc(1, 0, 4, 1);
gbl.setConstraints(tableIFrame,gbc2);
desktop.add(tableIFrame);
[...]

the makegbc is nothing more than:
private GridBagConstraints makegbc(int x, int y, int width, int height)
{
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = x;
gbc.gridy = y;
gbc.gridwidth = width;
gbc.gridheight = height;
gbc.insets = new Insets(1, 1, 1, 1);
return gbc;
}

Can anyone give me some hints?

Thx in advance

Thomas Pototschnig


 
Thomas Pototschnig





PostPosted: 2005-5-7 19:08:00 Top

java-programmer >> GridBagLayout on JDesktop I figured out that the size of my JInternalFrames is dominated by the
components inside of the InternalFrame -
is there a way to force the components inside to accept the size of the
Frame?

Thomas Pototschnig