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

  • Home
  • SEARCH
  • 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 8703511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:53:06+00:00 2026-06-13T02:53:06+00:00

A while ago, I read that the best way to switch between different screens

  • 0

A while ago, I read that the best way to switch between different “screens” in an application would be to set up different JFrames and then simply dipose the first and call the second. For example I have Screen A extending JFrame and Screen B extending JFrame, on a button that should switch to the next screen I would write something like that

JButton button = new JButton("show next screen");
button.addActionListener(){
    new ScreenB();
    frameA.dispose(); // assumed that we coded something like frameA = this earlier
}

Now the problem is that between the changeover of the two frames, I see for let’s say 1/10 either Screen A or Screen B, which is very ugly. What would be a better solution? Extending the screens as Container and set them as ContentPane for the always the same JFrame?

  • 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-06-13T02:53:07+00:00Added an answer on June 13, 2026 at 2:53 am

    Try attaching a WindowListener to FrameA

    In you action listener call frameA.dipsose(), so long as the frame set set to DISPOSE_ON_CLOSE it will trigger a windowClosed event in the WindowListener.

    When this occurs, you can now open you new window.

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

Sidebar

Related Questions

I read somewhere a while ago that it would be possible to use 32
A while ago I read a news here , that Microsoft changed its strategy
A while ago I read somewhere that SSE intrinsic functions compile into efficient machine
A while ago, I saw on a Screencast a tool that could be ran
A while ago I wrote a plan management system for the council that I
A while ago, I wrote a program that outputs any localhost or network database
A while ago I wrote an app that relied on XML coming out of
A while ago I read about Scala for LLVM and I kept wondering which
I have a program that crashes (attempting to read a bad memory address) while
Some days ago, I decided that it would be fun to write a streambuf

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.