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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:50:42+00:00 2026-05-24T12:50:42+00:00

I started using MiGLayout about a month and half ago and everything is simple

  • 0

I started using MiGLayout about a month and half ago and everything is simple and works great. There’s only one issue I still have that I haven’t been able to fix.

Let’s say I want to have a row that has two buttons on the right-most side and a centered title, the title doesn’t actually get centered when I do it this way:

(“this” is a JPanel)

this.add(labelTitle, "split, span, center");
this.add(closeButton, "east");
this.add(mainMenuButton, "east");   

What happens is that “labelTitle” is centered in the remaining space available after the buttons are placed, but I actually want it to be centered relative to the whole JPanel, not just the remaining space.

What parameters could I use to get the desired effect? I know I could use absolute positioning, but I don’t want to do that because it defeats the purpose of using MiGLayout in the first place in my case.

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

    Can it be something like this you are looking for?

    Cheers!

    public static void main(String[] args)
    {
        JFrame frame = new JFrame();
    
        JPanel panel = new JPanel(new MigLayout("debug"));
        panel.add(new JLabel("Label Title"), "x2 min(b1.x - unrel, (container.w+pref)/2)");
        panel.add(new JButton("Close Button"), "id b1, pushx, alignx right");
        panel.add(new JButton("Main Menu Button"), "alignx right");
    
        frame.add(panel);
        frame.setSize(800, 200);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started using Zend_Paginator, it works everything fine but I noticed that there is
I started using ActiveAdmin recently in a project and almost everything works great but
I started using Sandcastle some time ago to generate a Documentation Website for one
just started using log4j in one of my home-projects and I was just about
I started using the MVC pattern a half year ago, and I still have
I started using subversion for one of my projects and it would be absolutely
We started using Mercurial a several weeks ago. Most developers follow this workflow: work
Few weeks ago I started using VS 2008 (Professional) with Windows 7 (Enterprise). When
I just recently started using this library (the one from CodePlex), but I ran
I just started using SVN as of last week (TortoiseSVN), is there any SVN

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.