I am trying to center the gap between two columns in a MigLayout. They should be aligned towards the center of the screen, but somehow I can't get it to actually be centered. Here's my code:
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
public class Main extends JFrame {
public Main() {
super("MigLayout Problems");
String lc = "wrap 2, fill, al 50% 50%";
String cc = "[right]15[left]";
String rc = "[]5[]";
JPanel subPanel = new JPanel();
subPanel.setLayout(new MigLayout(lc, cc, rc));
JLabel label = new JLabel("Some text");
JTextArea area = new JTextArea();
area.setText("This belongs to label1");
subPanel.add(label);
subPanel.add(area);
add(subPanel);
setSize(400, 400);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
But the result I get looks like this:
|----------------------------|-----------------------------|
| |Some text| |This belongs to label1| |
| |
|----------------------------|-----------------------------|
What I want is something like this:
|----------------------------|-----------------------------|
| |Some text| |This belongs to label1| |
| |
|----------------------------|-----------------------------|
So to clarify, that gap between the two components is supposed to be centered in the panel. What am I missing here?