> I'm having a problem with the layout management of a JPanel. The panel
> is not extending the full width horizontally of the tabbedpane in
> which it is placed and all the controls are all bunched up together
> inside the titled border of this JPanel
No, I don't want to lay them out horizontally, I want them to expand
in proportion horizontally. The GridBagLayout provides the flexibility
I need. Problem is the controls in each panel bunch up together in the
center inside the titledborder which doesn't extend all the way
across. I end up w/ three panels of different sizes in the correct
vertical order (i.e. topPanel, midPanel, bottomPanel), but they just
don't extend horizontally the full width.
---
myPane = new MyPane();
tabbedPane.addTab("myTopPanel", myPane);
...
rightSplitPanel.add(tabbedPane, BoderLayout.NORTH);
---
public class MyPane extends JPanel implements ..., ... {
...
public void createTopPanel() {
JComponent comp = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 1;
...
// lots of JTextFields, Combo's, Labels, etc... here
...
comp.setBorder(BorderFactory.createTitledBorder("blah"));
this.add(comp, BorderLayout.PAGE_START);
...
}
public void createMiddlePanel() {
JComponent comp = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 1;
...
// lots of JTextFields, Combo's, Labels, etc... here
...
comp.setBorder(BorderFactory.createTitledBorder("blah"));
this.add(comp, BorderLayout.PAGE_START);
...
}
public void createBottomPanel() {
JComponent comp = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 1;
...
// lots of JTextFields, Combo's, Labels, etc... here
...
comp.setBorder(BorderFactory.createTitledBorder("blah"));
this.add(comp, BorderLayout.PAGE_END);
...
}
}