MigLayout Shrink Behavior

with JPanel defined below (embedded in JTabPanel in JSplitPane):

If I maximize the panel redraws correctly to the new dimensions If I minimize the panel, it does NOT redraw in the previous dimensions If I drag the corner to increase the size, the panel redraws to correct the dimensions If I drag the corner to reduce the size, the panel does NOT redraw to the expected size ...

container.setLayout(new MigLayout("debug,fillx,wrap 5",
    "[75:75:75][fill][75:75:75][fill][140:140:140,align left]"));
container.add(labelSrcTitle, "span 4");
container.add(buttonAddRef, "");
container.add(srcTitle, "span");
container.add(srcListing, "span,grow");
container.add(sepRef,"span,growx");
container.add(refTitle,"span");
container.add(refListing,"span 4,grow");
container.add(buttonEdit,"split 2");
container.add(buttonDelete,"");
container.add(name,"span 4,growx");
container.add(buttonSEdit,"split 3");
container.add(buttonSDelete);
container.add(buttonSAdd,"");
container.add(lType,"");
container.add(lClaim,"grow");
container.add(lQual,"");
container.add(lNotes,"grow");
container.add(buttonCEdit, "split 3");
container.add(buttonCDelete);
container.add(buttonCAdd, "");

      

I would like (and expect) that if I maximize and then hide, the screen will be redrawn to its original configuration. what am i missing? If it matters, all JTextArea fields will be bound to the string true.

Edited:

Here's a much simpler example - the problem seems to be with the JTextArea with linewrap enabled. The following code in JFrame recreates the problem:

    JPanel root = new JPanel(new MigLayout("fill,debug"));
    JTextArea t = new JTextArea();

    t.setLineWrap(true);

    root.add(t,"growx");
    setContentPane(root);
    setLocationRelativeTo(null);
    setSize(200, 200);

      

+3


source to share


1 answer


The problem has been resolved. After identifying the problem with the JTextArea and Line Wrap, I determined that it was a sign that the MigLayout and JTextArea Line were wrapped in multiple places; and resolved it by changing root.add (t, "growx") to root.add (t, "growx, wmin 10")



+2


source







All Articles