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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:22:52+00:00 2026-05-12T12:22:52+00:00

I am testing out MigLayout for a project, and I can’t seem to figure

  • 0

I am testing out MigLayout for a project, and I can’t seem to figure out the MigLayout way of controlling the size of the whole panel which is being layed out. I am adapting the example in the MigLayout whitepaper. Also, I am writing in Python and using Jython rather than writing in Java. That said, here is my current code.

layout = MigLayout("fillx",
                   # Column constraints
                   "[right]rel[grow,fill]",
                   # Row constraints
                   "[]10[]10[]")
panel = JPanel(layout)

panel.add(JLabel("Enter size:"),
          "")
panel.add(JTextField(""),
          "wrap, width 150:250")
panel.add(JLabel("Enter weight:"),
          "")
panel.add(JTextField(""),
          "wrap, width 150:250")
panel.add(JButton("Ok"),
          "span 2, align center, width 100:150")

The panel then goes into a JFrame for display. When I resize the frame, the controls resize nicely and obey their minimum sizes. However, there is no minimum size on the frame, nor does there seem to be any way to get to the real minimum size of the panel to set it for the frame. Asking for the panel’s minimum size returns a size which, when set on the frame (plus insets), cuts off the button and half of the text fields.

What I want is to be able to set the minimum size for the frame (not hard-coded!) so that the panel fits and none of its controls are cut off. What is the best way to do this?

  • 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-12T12:22:52+00:00Added an answer on May 12, 2026 at 12:22 pm

    Personally, I wouldn’t stress too much about the minimum size as long as the preferred size (what you get after pack() is appropriate. If for some reason the user wants to reduce the window down to a size where the components in it get clipped, then let them. Maybe they just want to get the bottom of your window out the way so they can see what remains and something else on their monitor at the same time.

    I would argue that the true minimum size of any window is the sum of it’s border and title bar and room for a few characters of the title text and an ellipsis. If the user want something smaller than what will allow all the components to show unclipped who are you to enforce otherwise?

    Using any of the several table-based layout managers available on the web, like MIG Layout, you should be able to easily get the resizing behavior you want.

    Shameless self plug: If you find MIG Layout hard to use, my MatrixLayout is, I think, easier to use. But MIG layout is more powerful. I deliberately chose to code MatrixLayout to not inhibit panels from reducing below their calculated minimum size.

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

Sidebar

Related Questions

when testing out our machine for apache or SVN, i found that we can
I'm testing out using memcached to cache django views. How can I tell if
I am testing out a WCF service which is running on the same machine
I am trying to figure out code working for an auto testing as follows:
I've been testing out the performance and memory profiler AQTime to see if it's
I'm testing out my application with the hopes of migrating to SQL Server 2008
I'm finally starting out with unit testing, having known that I should be doing
I am starting out with unit testing, I have a method that uses the
I am starting out with automated testing and I would like to test one
I'm having trouble figuring out how to get the testing framework set up and

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.