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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:24:29+00:00 2026-05-27T07:24:29+00:00

I’m using the MiGLayout to create several different JPanels, however I’m having a problem

  • 0

I’m using the MiGLayout to create several different JPanels, however I’m having a problem resizing one of them. Below is a diagram showing what I want to achieve:

-------------------------------------------------------
|                                                     |
|                        Panel 1                      |
|                                                     |
-------------------------------------------------------
--------------------------- ---------------------------
|                         | |                         |
|         Panel 2         | |          Panel 3        |
|                         | |                         |
--------------------------- ---------------------------

The key thing I want to achieve is to make Panel 1 spread across the two other panels. I seem to have achieved this layout, however I’ve got an issue such that the border isn’t showing up for Panel 1 as shown in my diagram. I have tried using the setSize method but it didn’t seem to work.

Here is the code I’m using to create the panels (please note I haven’t included the widgets inside the panel):

    // Create Panel 1
    JPanel panelOne = new JPanel();
    panelone.setSize(600, 50);
    panelOne.setBorder(BorderFactory.createTitledBorder("Panel 1"));
    panelOne.setLayout(new MigLayout());

    // Create Panel 2
    JPanel panelTwo = new JPanel();
    panelTwo.setBorder(BorderFactory.createTitledBorder("Panel 2"));
    panelTwo.setLayout(new MigLayout());

    // Create Panel 3
    JPanel panelThree = new JPanel();
    panelThree.setBorder(BorderFactory.createTitledBorder("Panel 3"));
    panelThree.setLayout(new MigLayout());

    // Add the panels to the main frame
    mainFrame.add(panelOne, "span, wrap, align center");
    mainFrame.add.add(panelTwo);
    mainFrame.add.add(panelThree);

Please can someone suggest a way to get the border to be shown as in my diagram?

  • 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-27T07:24:29+00:00Added an answer on May 27, 2026 at 7:24 am

    Try this:

    mainFrame.getContentPane().setLayout(new MigLayout());
    getContentPane().add(panelTwo);
    getContentPane().add(panelThree,  "wrap");   // Wrap to next row
    getContentPane().add(panelOne, "dock north");
    

    Also, ensure you are adding your GUI elements to the main frame’s content pane not to the frame itself.

    EDIT From the comments below:
    You can also use new CC.wrap() or new CC.dockNorth()
    Thanks to @Andrew Thompson and @Howard for the tip 🙂

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
Does anyone know how can I replace this 2 symbol below from the string

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.