I'm trying to insert a new panel into another panel in runtime everytime I press a button. My problem is the original panel runs out of space and I can't see the new panels I'm adding.
What I've tried so far:
- Using scrollpane for vertical scrolling with no success.
- Using flowlayout-no luck. Tried disabling horizontal scrolling-keep pushing the new panel to the right (can't get to it because there is no scrolling).
- Tried using borderlayout-no luck.
testpanel t = new testpanel();
t.setVisible(true);
this.jPanel15.add(t);
this.jPanel15.validate();
this.jPanel15.repaint();
This code suppose to insert the t
panel into jpanel15
.
With flowlayout it pushes the t
panel downwards just like I want it to but with no vertical scroll.
PS: I'm using netbeans in order to create my GUI.
ctrl.setAlignmentX( Component.LEFT_ALIGNMENT );
– TT. Jun 03 '13 at 11:34