From 620ac64a92ba0fc5fea11cef77f48059348f2cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustafsson?= Date: Mon, 8 Mar 2021 21:46:48 +0100 Subject: [PATCH] Fix illegal component position exception in addToCanvas --- src/net/sf/freecol/client/gui/Canvas.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/net/sf/freecol/client/gui/Canvas.java b/src/net/sf/freecol/client/gui/Canvas.java index e71b6c4619..ba54881eec 100644 --- a/src/net/sf/freecol/client/gui/Canvas.java +++ b/src/net/sf/freecol/client/gui/Canvas.java @@ -369,6 +369,8 @@ private void addToLayer(Component comp, Integer layer) { */ private void addToCanvas(Component comp, Integer layer) { try { + // To avoid illegal component position exception - remove the component first + remove(comp); add(comp, layer); } catch (Exception e) { logger.log(Level.WARNING, "addToCanvas("