Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JFrame and/or JPanel is being weird..

807603Dec 15 2007 — edited Dec 16 2007
I've made a JFrame with a menu bar. There's some options in the menu bar namely 'a' and 'b'. I have made 2 JPanels as separate classes in the same folder, and whenever I choose an option from my menu, the corresponding JPanel would show up in my JFrame. Now, the problem is, the panels don't show up straight away, only if I resize the JFrame window (Maximizing it or restoring it - minimizing doesn't work) I can get it to display, else, it just gives me a blank screen

On my next attempt, I used the removeAll () method to delete and remake everything inside the frame every time an option is chosen. That didn't help, the same thing happens.

On my latest attempt, I simply tried to add() the chosen component despite what was before it. Now the panels still won't show up unless I resize the frame, and now they are just paining on top of one another.

Am I missing some critical piece of knowledge? Please help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2008
Added on Dec 15 2007
7 comments
346 views