praks
March 13th, 1999, 02:25 AM
Hi,
I have to make a dynamic expandable Frame. Means by default only one portion of
the Frame has to be visible and depending on the action in that portion the rest
part of the frame should be visible. e.g. after clicking one button on the
visible frame.
Can somebody help me regarding this.
Thanks
..praks
thiru
March 17th, 1999, 05:05 AM
Hi praks,
I have 2 suggestions for ur problems:
1. Disable all components that u wish to hide and then say on click of a button
make them visible(setVisible(true)).This might be tedious if u have more number
of components in ur container.
2.Divide ur froam into suitable panels and only enable a single panel when the
the window opens up.Later,the panels could be enabled based on soem events
if u have better solutions,pl let me know
bset wishes
thiru
Alex
March 18th, 1999, 11:49 AM
I just did exactly the same thing yesterday! Here's how it works for me:
- instantiate and load all the components in a frame
- the ones that shouldn't be displayed initially must be set like this:
component.setPreferredSize(new Dimension(0, 0));
component.setMaximumSize(new Dimension(0, 0));
component.setMinimumSize(new Dimension(0, 0));
- when the button is clicked (or, on any other suitable event), do this:
private void showEverythingAndResize(){
component.setPreferredSize(new Dimension(60, 25));
component.setMaximumSize(new Dimension(65, 25));
component.setMinimumSize(new Dimension(50, 25));
Rectangle r=f.getBounds();
r.setSize(r.width+1, r.height);
frame.setBounds(r);
}
Alex