Re: Expanded view of frame
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
Re: Expanded view of frame
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