adding JPanel to another Panel
Posted on 2004-09-09
I have a function getTblPnl() which returns a JPanel. //Lets call this panel p.
I have another JPanel called mainWin.
I already have the following code which will allow me to add onto mainWin. (below)
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
I would like to decrease the size of p which is in mainWin. How can I do that? Also, i need to keep the flowlayout south.
Furthermore, I already have set the size of p in getTblPnl() using the code below:
pT.setPreferredSize(new Dimension(pT.getPreferredSize().width, 435));
But if I decrease the size here, there is a big gap between the first panel and this panel in mainWin.
How can I decrease the size to 285 w/o the big gap in the mainWin panel?