Reputation: 1630
with the JPanel defined below (embedded in a JTabPanel in a JSplitPane):
If I maximize, the panel is redrawn correctly to the new dimensions If I minimize the panel is NOT redrawn to the previous dimensions If I drag the corner to increase the size the panel is redrawn to correct dimensions If I drag a corner to decrease size the panel is NOT redrawn to the expected dimensions
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 then minimize, the screen will get redrawn to its original configuration. what am I missing? If it matters, all the JTextArea fields are line wrap true.
Here is a much simpler example - the issue seems to be with JTextArea with linewrap set on. The following code in a JFrame recreates the issue:
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);
Upvotes: 4
Views: 2015
Reputation: 1630
Problem solved. After identifying the issue to JTextArea and Line Wrap, I determined that it was a symptom of MigLayout and JTextArea Line wrap documented in several places; and resolved it by changing root.add(t,"growx") to root.add(t,"growx,wmin 10")
Upvotes: 3