Posted Wednesday, September 12, 2007 @ 09:59:01
btw, thanks for the quick reply!
I created a class that extends JPanel and then put each of these on a tabbed frame. I want(ed) the dbtable to resize itself when the application main frame was resized.
/************** this is the method that the component resize event calls in the main (parent) class *************
public void jTab_Pane_componentResized(ComponentEvent e) {
pnlReference.setSize(e.getComponent().getSize());
pnlOperators.setSize(e.getComponent().getSize());
}
/*********** this is in the extended class ***********
private void setQtableSize(int w, int h) {
if (w > 10) {
w = w - 10;
}
if (h > 10) {
h = h - 10;
}
// This seems really bogus but it doesn't work without it since setting 'setSize()' by itself does nothing.
qTable.setPreferredSize(new Dimension(w, h));
// Force it to re-layout
this.validate();
}