nanode
10-10-2000, 12:13 PM
A code snippet is best to explain:
public class NotebookTab extends JPanel {
private JTabbedPane jtp = new JTabbedPane();
public NoteBookTab() {
this.add(jtp);
}
...
That's condensed quite a bit, I get a JPanel w/ a JTabbedPane upon construction.
Also in this class is a changeSize method:
private void changeSize(int w, int h) {
Dimension tmpDim = jtp.getSize();
jtp.setSize(tmpDim.width + w, tmpDim.height + h);
}
The changeSize mehtod works great, but the dimensions get tossed out and return to the default size when I change tabs.
I even added a few instances of this to a JPanel - and changing tabs resizes all instances of this class back to their default size.
Any ideas how to prevent this?
public class NotebookTab extends JPanel {
private JTabbedPane jtp = new JTabbedPane();
public NoteBookTab() {
this.add(jtp);
}
...
That's condensed quite a bit, I get a JPanel w/ a JTabbedPane upon construction.
Also in this class is a changeSize method:
private void changeSize(int w, int h) {
Dimension tmpDim = jtp.getSize();
jtp.setSize(tmpDim.width + w, tmpDim.height + h);
}
The changeSize mehtod works great, but the dimensions get tossed out and return to the default size when I change tabs.
I even added a few instances of this to a JPanel - and changing tabs resizes all instances of this class back to their default size.
Any ideas how to prevent this?