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 8657693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:35:06+00:00 2026-06-12T15:35:06+00:00

My program looks like this! I want to have the bottom part dynamically load

  • 0

My program looks like this!

enter image description here

I want to have the bottom part dynamically load a frame into the bottom frame depending on the item selected in the ComboBox. For example, if the first item is selected I want a panel from the PresentValue.java file displayed. The idea is that I have one java file for each selection that displays what I design in its respective java file.

enter image description here

enter image description here

These two java files should be put into the “bottom” box from my first screenshot, depending on the selection from the combobox.

I’m more used to Android programming and there I would simple call the replace method from fragments to swap out the fragment loaded… looking for the analogy here.

final JComboBox selectorBox = new JComboBox(selection);
    selectorBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            int selectionID = selectorBox.getSelectedIndex();

        }
    });

but cant find a way to do what I want to do. Please explain.

  • 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-12T15:35:07+00:00Added an answer on June 12, 2026 at 3:35 pm

    For each Java file that you have, the output of that Java file should be a JPanel. Not a JFrame.

    Before you display anything, execute all of the Java files you have. Create all of the possible JPanels.

    Create your JFrame in your GUI, then use the remove and add methods of JFrame to remove or add the desired JPanel.

    Here’s an example from one of my GUI’s.

    public void updatePartControl() {
        Thread thread = new CountdownThread(model, this, displayPanel);
        thread.start();
    
        frame.remove(alarmPanel.getPanel());
        frame.add(displayPanel.getPanel());
        frame.validate();
        frame.pack();
        frame.setBounds(getBounds());
    }
    

    The setBounds method resets the bounds if the display JPanel is bigger or smaller than the alarm JPanel.

    Your application should have one JFrame. You use multiple JPanels to create your GUI.

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

Sidebar

Related Questions

I have a program that looks like this. I need to consistently write something
I have a program that looks something like this: public partial class It {
I have a code at the top of my program that looks like this:
I have program output that looks like this (tab delim): $ ./mycode somefile 0000000000000000000000000000000000
I have declared a DLL import in my C# program that looks like this:
My program looks like this: -(id)init { if ( (self = [super init]) )
I wrote a program called Hello.py that looks like this: import pygame, sys from
I created a setuid program in C. The executable looks like this: -r-s-r-s--- 1
I have a program that looks like the following: double[4][4] startMatrix; double[4][4] inverseMatrix; initialize(startMatrix)
I have method for converting array of Booleans to integer. It looks like this

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.