Link to home
Start Free TrialLog in
Avatar of dshrenik
dshrenikFlag for United States of America

asked on

Java Swing: Components don't show up

I am adding a JPanel to another JPanel. The problem is that the inner JPanel does not show up until I click at the location where it is supposed to appear.

Please let me know what I could be missing. Thanks!
ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America 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
Maybe you want to paste your code.
It is very common to add one JPanel to another JPanel - should not have any problems
Avatar of dshrenik

ASKER

Unfortunately, I'm not allowed to paste code. Sorry about that!
Can you tell me some possible things that could be going wrong?

I think HonorGod has a good point - are you indedadding the second ;panel after you show the window?
In general, unless there is some specvial need - just create all GUI first and then show
the window when all elements are already created and are in place, then say
setVisible(true);
I am not sure. Sorry if question sounds silly - I am new to Swing:
What is the frame here, and how do I get a reference to it?
Do I just say this.repaint()? (where this is a jpanel)?
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
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
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
Thanks for the grade & points.

Good luck & have a great day.