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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:26:39+00:00 2026-05-29T05:26:39+00:00

Basicly i’ve got this setup | JFrame with BorderLayout | | ————————– | |

  • 0

Basicly i’ve got this setup

    | JFrame with BorderLayout   |
    | -------------------------- |
    | JPanel with GridBagLayout  |
    | JPanel with NullLayout     |

The JFrame is resizable. The JPanel with GridBagLayout contains itselt gain JPanels and looks basicly like this

    |Obj|Obj|Obj|
    |Obj|Obj|Obj|
    |Obj|Obj|Obj|

The Grid should be quadratic.

If I resize the window, the components will be adjusted automaticly and because of this, the Grid looses it’s qudratic dimension and becomes an rectangel.

I can prevent this by writing my own layout manager. So my question to you: is there another possibility to enforce a quadratic grid?

  • 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-29T05:26:40+00:00Added an answer on May 29, 2026 at 5:26 am

    Instead of using GridBagLayout, consider using MigLayout.

    You can also use a null layout which sets width and height of each component as the width or height divided by either number of rows or columns (depending on how you want to go about it), and set the initial x and y to values according to this:

    (total width % number of columns) / 2

    and the others to simply
    initialX + cellWidth * (col - 1) and
    initialY + cellWidth * (row - 1).

    Put this code into your componentResized(ComponentEvent e){...}
    method of your middle JPanel‘s ComponentListener, and cycle through your cells (panels) setting their bounds. This might be a slow / manual way but you’ll have complete control of exactly how you want them to resize.

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

Sidebar

Related Questions

basicly I've got an array and want to call the same function for each
What I'm trying to do is basicly what this photo shows. When I select
I'm basicly going on this site: http://blog.velir.com/index.php/2010/11/17/android-snapping-horizontal-scroll/ But i'm having this problem: Caused by:
I'm having problem with my array basicly this is what i have: $test =
I am using Navigation framework and basicly got one frame that is used for
Okay, so basicly I have this website that auto refreshes every couple of seconds,
Ok, so I basicly have this list. What I'm trying to do is just
maybe its late or something, but this is freaking me out. Basicly im writing
Basicly this is what I have: Server:: Server (int port) { cout << Initializing
alt text http://produits-lemieux.com/database.jpg This is basicly my database structure one product (let say soap)

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.