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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:10:29+00:00 2026-06-06T01:10:29+00:00

got some problems. Built an applet that has to be used step-by-step. After each

  • 0

got some problems.

Built an applet that has to be used step-by-step. After each step, a button is clicked and the next step should be added into the GUI.

Problem: without zooming, the added content doesn’t get visible. in a application you can workaround with scaling the window size, but in an applet I wasn’t able to solve that problem.

Thanks

EDIT:

actually, it looks smth like this:

 Panel cp = new Panel(new GridLayout(0,2));
 Panel Block1 = new Panel(new GridLayout(2,2));
 Panel Block1 = new Panel(new GridLayout(2,2));
  ...

init

 public void init()
  {  

   buildBlock1();
   buildBlock2();


    add(cp);
    cp.setVisible(true);
  }

adding some empty panels here, those who will get filled afterwards

private void buildBlock1()
{
Block1.add(panel1);
Block1.add(panel2);
Block1.add(panel3);
Block1.add(panel4);

cp.add(Block1);
}

button actionlistener

private void generatePanel1()
 {
  //adding some Components to the subpanel of Block1, which is a subpanel of cp.
 Panel1.add(...);
 cp.repaint();
 cp.validate();
 }
  • 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-06T01:10:32+00:00Added an answer on June 6, 2026 at 1:10 am

    Now I don’t have any code that I can check but adding (and removing) components to a container normally often needs to be “validated”. So try

    panel.add(...); 
    panel.revalidate(); 
    

    API docs for JComponent.revalidate():

    Validates this container and all of its subcomponents.

    Supports deferred automatic layout.

    Calls invalidate and then adds this component’s validateRoot to a list of components that need to be validated. Validation will occur after all currently pending events have been dispatched. In other words after this method is called, the first validateRoot (if any) found when walking up the containment hierarchy of this component will be validated. By default, JRootPane, JScrollPane, and JTextField return true from isValidateRoot.

    This method will automatically be called on this component when a property value changes such that size, location, or internal layout of this component has been affected. This automatic updating differs from the AWT because programs generally no longer need to invoke validate to get the contents of the GUI to update. The validate method is used to cause a container to lay out its subcomponents again. It should be invoked when this container’s subcomponents are modified (added to or removed from the container, or layout-related information changed) 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

got some problems deploying a java web application on jboss 7.1... Stepped through the
I got some problems with EOF and stdio in a communication pipeline between a
I got some problems with the error Link error LNK2005 ... already defined. The
I've got some problems on a .NET site where both Latin (åäö) and Latvian
i'm new to java and i got some problems. i'm developping a web application
I'm trying to make a appcache file but got some problems... I've added the
I was trying to perform a SQL statement and got some problems with encoding.
I'm a beginner in Java and I have got some problems with the static
I working on my first ASP.net MVC project and and i got some problems
I'm working on a online game. I got some problems with inserting new data

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.