浏览代码

Fix a bug where we weren't adding the model components above the empty one.

Sam Jaffe 5 年之前
父节点
当前提交
b16fa84016
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/main/lombok/org/leumasjaffe/recipe/view/BetterAutoGrowPanel.java

+ 3 - 4
src/main/lombok/org/leumasjaffe/recipe/view/BetterAutoGrowPanel.java

@@ -123,13 +123,12 @@ public class BetterAutoGrowPanel<C extends Component & BetterAutoGrowPanel.Child
 		this.models = models;
 		this.callback = callback;
 		
-		final List<ChildComponent> shim = this.members.subList(0, lastIndex());
-		shim.clear();
+		this.members.subList(0, lastIndex()).clear();
 		models.forEach(model -> {
 			final C comp = this.grow.makeComponent.apply(model);
 			comp.addGrowShrinkListener(new ShrinkOnEmpty(comp));
-			shim.add(comp);
-			add(comp);
+			add(comp, lastIndex());
+			this.members.add(lastIndex(), comp);
 		});
 	}