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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:31:16+00:00 2026-05-27T18:31:16+00:00

so i have a problem i cant solve i want my GUI app to

  • 0

so i have a problem i cant solve i want my GUI app to be split between 3 JPanels (left, center, right). I want left panel and right panel to be of fixed size and center to be fluid. Meaning side panels expand only vertically as JFrame is expanded and center panel expands bot horizontally and vertically.

I have set minimal size for all panels to be height of 600 but they just stay in the minimal size and dont expand as JForm increases i dont know how to set bounds to JFrame borders so they expand whit it.

package ppe.view;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import net.miginfocom.swing.MigLayout;

public class UI_View extends JFrame
{
    private JList       browse  = new JList();
    private JScrollPane rightX   = new JScrollPane();
    private JButton     btn1    = new JButton("Button 1");
    private JButton     btn2    = new JButton("Button 2");
    private JButton     btn3    = new JButton("Button 3");
    private JButton     btn4    = new JButton("Button 4");


    public UI_View()
    {
        this.setTitle("Prototype MVC Arhitecture");
        this.setMinimumSize(new Dimension(800, 600));
        this.setExtendedState(this.MAXIMIZED_BOTH);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLayout(new MigLayout());

        JPanel content = new JPanel(new MigLayout());
        content.setBackground(Color.black);

        JPanel right  = new JPanel(new MigLayout());
        JPanel center = new JPanel(new MigLayout());
        JPanel left   = new JPanel(new MigLayout());

        right.setBackground(Color.red);
        right.setMinimumSize(new Dimension(200, 600));
        right.setMaximumSize(new Dimension(200, 37500));

        center.setBackground(Color.green);
        center.setMinimumSize(new Dimension(400, 600));

        left.setBackground(Color.blue);
        left.setMinimumSize(new Dimension(200, 600));
        left.setMaximumSize(new Dimension(200, 37500));

        content.add(left);
        content.add(center);
        content.add(right);

        this.setContentPane(content);
    }

    public static void main(String[] args)
    {
        new UI_View().setVisible(true);
    }

}

I have tryed bounding them to another content panel and adding that panel as ContentPane to JFrame that automatically bounds it to JFrame border but the thing is still pretty much fixed.

  • 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-27T18:31:17+00:00Added an answer on May 27, 2026 at 6:31 pm

    If you’re using MiGLayout why don’t you configure the constraints when adding the components?

    This, for example, might help (although I’m a MiGLayout beginner, too):

     content.add(left, "growy");
     content.add(center, "grow"); //the same as growx, growy
     content.add(right, "growy");
    

    In some cases I needed to also add a pushx but I’m not sure when this is needed. Please refer to the documentation for further information.

    Edit: it seems like you always have to add push for components that should cause the column/row to grow. Otherwise grow alone would make the components as big as the column/row they are in which in turn is defined by the largest component in that column/row. If there is more space available columns/rows won’t grow to fill it without the push keyword.

    From the documentation:

    Components will never “push” the column/row’s size to be larger using the grow keyword.

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

Sidebar

Related Questions

I have a problem that i cant solve :( I have a user control
I have a problem, I can't solve properly. In short: I want to create
I want to move a right menu to the left side, the problem is
I have a problem and can't solve it alone. My teacher gives me one
i have a problem that i can't solve ! (sqlite3, but i think it
I have a script that constantly segfaults - the problem that I can't solve
I have such a basic problem in Delphi,I can't solve it. My Code: Note:DataR
I have a problem which I cant seem to find answer to through searches
I have a weird problem with images in visual web developer, I cant change
I have a problem with group expressions in a list. I want to use

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.