0

I have a JPanel (extended by my GeneralOptions class) implemented as:

public GeneralOptions() {
    setLayout(new MigLayout("", "[grow]", "[][][][]"));

    JLabel lblWyzywienie = new JLabel("Food");
    add(lblWyzywienie, "cell 0 0");

    JCheckBox chckbxHb = new JCheckBox("HB");
    add(chckbxHb, "cell 0 1");
    JCheckBox chckbxBb = new JCheckBox("BB");
    add(chckbxBb, "cell 0 1,alignx trailing");
    JCheckBox chckbxAll = new JCheckBox("All Inclusive");
    add(chckbxAll, "cell 0 1,alignx trailing");

}

As you can see, there is a list of checkboxes in one cell of MigLayout. This JPanel in placed as left panel of SplitPanel component, so its width is resizable.

What I want to achieve is to force this list of checkboxes to act like "inline" html list of checkboxes. This means, that they should break line when width of panel is not enough to show them in single line.

Now I can't resize this panel below width of whole list and if init width is less than this list of checkboxes, some of them are just hidden.

Example html code http://jsfiddle.net/ You can try to resize right panel to see what I'm talking about.

AlexR
  • 114,158
  • 16
  • 130
  • 208
Jakub Matczak
  • 15,341
  • 5
  • 46
  • 64

1 Answers1

1

Take a look on the following discussion: http://migcalendar.com/forums/viewtopic.php?f=8&t=2393

Scroll down to see the code. He actually implemented his own layout manager that does exactly what you want.

AlexR
  • 114,158
  • 16
  • 130
  • 208