Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3618840
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:48:13+00:00 2026-05-18T22:48:13+00:00

So i have a frame and 2 panels, originally panel A is displayed in

  • 0

So i have a frame and 2 panels, originally panel A is displayed in the frame. i have got it set up so when a button is clicked in the panel it makes a call back to the frame and runs this bit of code. (“splash” is the panel that is originally displayed and “game” is the panel i want to show after the button press)

public void startGame()
{
    System.out.println("starting game");
    remove(splash);

    gameThread = new Thread(game, "game thread");
    gameThread.start();
    add(game);

    /*
    this.setSize(0,0);
    this.setSize(450, 450);
    */
}

anyways this seems to remove the one panel fine but wont display the second panel until you resize the window. the commented section seems to solve this problem but i cant help think there is a better way to do this. i have surfed the API and haven’t found anything helpful.

if anyone knows a better way, or has run into this problem. please share your knowledge, this one has me stumped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:48:13+00:00Added an answer on May 18, 2026 at 10:48 pm

    As Michael pointed out CardLayout is a good way to go.

    The specific functionality you are looking for is Container.validate(). It will “cause the container to lay out its subcomponents again. It should be invoked when this container’s subcomponents are modified … after the container has been displayed.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code <html> <head> <style type=text/css> .frame {width: 50em; border: 1px solid
I have a WxPython frame containing a single item, such as: class Panel(wx.Panel): def
I have a frame with 4 JPanels and 1 JScrollPane, the 4 panels are
I have no frame of reference in terms of what's considered fast; I'd always
I have subclassed java.awt.Frame and have overridden the paint() method as I wish to
I have a Window where I have put a Frame. I would like to
I have a bowling web application that allows pretty detailed frame-by-frame information entry. One
I have a list of (64-bit) addresses that represent a stack frame, and I
I have a WPF Window which has a among other controls hosts a Frame.
Because Canvas3D doesn't have the ability to resize dynamically with the parent frame, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.