浏览代码

Fix components not disappearing properly.

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

+ 4 - 0
src/main/lombok/org/leumasjaffe/recipe/controller/ReplaceChildrenController.java

@@ -22,6 +22,10 @@ public class ReplaceChildrenController<T, V> implements BiConsumer<Container, T>
 		if (parent.getComponents().length == children.size()) {
 			return;
 		}
+		// Make sure that our components disappear correctly
+		for (final Component comp : parent.getComponents()) {
+			comp.setVisible(false);
+		}
 		parent.removeAll();
 		children.stream().map(makeView).forEach(parent::add);
 	}