From 37a1f7248a1e1f6743a35843f9652ed135288909 Mon Sep 17 00:00:00 2001 From: xfarrow Date: Mon, 7 Aug 2023 16:07:07 +0200 Subject: [PATCH] enhancement --- Guify/src/views/Desktop.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Guify/src/views/Desktop.java b/Guify/src/views/Desktop.java index 4cc1e90..80b718b 100644 --- a/Guify/src/views/Desktop.java +++ b/Guify/src/views/Desktop.java @@ -14,6 +14,7 @@ import code.Constants; import code.Constants.GuifyColors; import code.TreeNode; import code.Helper; +import code.IDirectoryNodeButton; import code.JDirectoryNodeButton; import code.WrapLayout; import controllers.DesktopController; @@ -1155,13 +1156,11 @@ public class Desktop extends JFrame implements IDesktopFrame { } private void unselectAllNodes() { - controller.clearSelectedNodes(); - // TODO: gotta enhance this for - for (Component component : desktopPanel.getComponents()) { - if (component instanceof JDirectoryNodeButton) { - component.setBackground(new Color(255, 255, 255)); - } + for (IDirectoryNodeButton directoryNode : controller + .getSelectedNodes()) { + ((JDirectoryNodeButton)directoryNode).setBackground(new Color(255, 255, 255)); } + controller.clearSelectedNodes(); updateToolBarItems(); }