Link to home
Start Free TrialLog in
Avatar of hipal
hipalFlag for United States of America

asked on

Random components on resizing frame

When I resize my frame (using button between minimize and close) I get few random components added to my frame (like JFileChooser) and JComponents which I added disappear.

Can some one please say something about such a behavior :(
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hipal

ASKER

what do you mean by changing layout ??

I am using null layout ..
i mean adding or removing components
Avatar of hipal

ASKER

The problem is not when I am moving/adding but when I am resizing frame
i realise that. resizing will trigger a relayout of the frame
and if you resize the frame by increasing onli width or height, do they dissapear in the same way?
Avatar of hipal

ASKER

when I say resize I actually mean resizing by clicking the by default 'restore' button between minimize and close tab ..even if I just increase height or width of frame using mouse .. the effect is same ..

Shall i try to resize frame in program on pressing a button ?? I mean is this what you want me to try when you asked  "if you resize the frame by increasing onli width or height, do they dissapear in the same way?"
definitely sounds like your not adding/removing components correctly (causing the panel to be not laid out as directed). When you resize the frame the frame gets laid out so that why you see the problem then.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
how the components that disappear are added to your container? by add and setBounds() or not?
Avatar of hipal

ASKER

sry fr late reply .. they are added using  add()
Avatar of hipal

ASKER

@CEHJ .. thanks a lot for responding.. but CEHJ .. I have been doing so in so many other small programs .. nothing wents wrong ..seems like I am doing something wrong here which I am not able to notice..

will go through code once again  .. else will post  it

thank you all of you experts !!
you'll get the same problem regardless of whether you use a layout manager or not (in fact it gets more complicated using a layout manager because adding a component can cause other to move)

see my earlier comments for likely cause of the problem.
Avatar of hipal

ASKER

thanks for response..

can you please elaborate on your previous comment which is

:definitely sounds like your not adding/removing components correctly (causing the panel to be not laid out as directed). When you resize the frame the frame gets laid out so that why you see the problem then.:
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial