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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:41:34+00:00 2026-06-05T13:41:34+00:00

I am creating a GUI with grid layout. I have added the JTextFields, JButtons

  • 0

I am creating a GUI with grid layout. I have added the JTextFields, JButtons and everything to it DIRECTLY. For an example, like this,

JButton b1 = new JButton("Hello"):
JButton b2 = new JButton("Bye");
JTextField t1 = new JTextField(10);
JTextField t2 = new JTextField(10);

GridLayout grid = new GridLayout(2,2,2,2);

JPanel panel = new JPanel();
panel.setLayout(grid);
panel.add(b1);
panel.add(t1);
panel.add(b2);
panel.add(t2);

In here, if the user resizes the window everything appears very large. The only other way I know to prevent these from getting these is adding all of each and everything to seperate JPanel which has FlowLayout. But thats not practical because if there are 20 stuff, there will be 20 JPanels. I tried setting the maximum size, minimum size and all, and they didnt change any. Please help.

  • 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-05T13:41:35+00:00Added an answer on June 5, 2026 at 1:41 pm
    1. not possible with plain GridLayout, because this is basic feature of this Layout Manager

    2. use proper Layout Manager GridBagLayout or todays MigLayout

    3. very simple way is by using SpringLayout

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

Sidebar

Related Questions

I had a huge file for creating this GUI and I have shortened it
I'm creating a gui api for games. I have for example a font for
I am creating a GUI program using MVC which should look like this.. alt
I'm creating a GUI and I would like an app that changes on based
I am creating one GUI in swing Java. I have to use one button
I'm creating an easy GUI using GridBagLayout and almost everything goes right, but there
I'm looking into creating a GUI program for Windows in C++, I have a
I am creating a GUI using Java. This GUI launches a program from the
I am creating a simple GUI in C++ which have few buttons in it.
I'm learning C# and I have to do a task of creating a GUI.

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.