Parcourir la source

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

Sam Jaffe il y a 5 ans
Parent
commit
b16fa84016

+ 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);
 		});
 	}