Solved

Random components on resizing frame

Posted on 2010-11-11
15
426 Views
Last Modified: 2012-05-10
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 :(
0
Comment
Question by:hipal
  • 6
  • 6
  • 2
  • +1
15 Comments
 
LVL 92

Accepted Solution

by:
objects earned 334 total points
ID: 34118199
sounds like you're not changing your ;layout correctly
may sure you call revalidate()/repaint() on any panel after you change its layout
0
 

Author Comment

by:hipal
ID: 34118210
what do you mean by changing layout ??

I am using null layout ..
0
 
LVL 92

Expert Comment

by:objects
ID: 34118258
i mean adding or removing components
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:hipal
ID: 34118272
The problem is not when I am moving/adding but when I am resizing frame
0
 
LVL 92

Expert Comment

by:objects
ID: 34118407
i realise that. resizing will trigger a relayout of the frame
0
 
LVL 16

Expert Comment

by:Valeri
ID: 34118456
and if you resize the frame by increasing onli width or height, do they dissapear in the same way?
0
 

Author Comment

by:hipal
ID: 34118484
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?"
0
 
LVL 92

Expert Comment

by:objects
ID: 34118521
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.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 166 total points
ID: 34118729
As i mentioned in an earlier question. Using a null layout will cause you problems. These are some of them. Be prepared for more
0
 
LVL 16

Expert Comment

by:Valeri
ID: 34120658
how the components that disappear are added to your container? by add and setBounds() or not?
0
 

Author Comment

by:hipal
ID: 34126148
sry fr late reply .. they are added using  add()
0
 

Author Comment

by:hipal
ID: 34126152
@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 !!
0
 
LVL 92

Expert Comment

by:objects
ID: 34126179
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.
0
 

Author Comment

by:hipal
ID: 34126184
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.:
0
 
LVL 92

Assisted Solution

by:objects
objects earned 334 total points
ID: 34126192
the resizing of the frame will trigger the panel being layed out and repainted. displaying any problems that have been caused by the layout being dynamically being changed earlier
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet example 17 32
Java string replace 11 48
Running JavaFX on JDeveloper 12C 1 32
String array comparison 4 34
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question