From 357aea509a96dfd20bd2d4d974f6e3fe7c30f42b Mon Sep 17 00:00:00 2001 From: Radek Davidek Date: Mon, 19 Jan 2026 13:51:01 +0100 Subject: [PATCH] active panel indicator moved --- .../java/cz/kamma/kfmanager/ui/FilePanel.java | 16 ++++++++++++++++ .../java/cz/kamma/kfmanager/ui/MainWindow.java | 14 +++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/java/cz/kamma/kfmanager/ui/FilePanel.java b/src/main/java/cz/kamma/kfmanager/ui/FilePanel.java index 16684f5..0666507 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/FilePanel.java +++ b/src/main/java/cz/kamma/kfmanager/ui/FilePanel.java @@ -499,6 +499,22 @@ public class FilePanel extends JPanel { updateTabStyles(); } + /** + * Set the active state of this panel to show/hide the focus indicator strip. + * The indicator is placed between the drive dropdown and the tabs. + */ + public void setActive(boolean active, Color activeColor) { + // Inactive indicator is subtle dark gray + Color inactiveColor = new Color(60, 60, 60); + Color targetColor = active ? activeColor : inactiveColor; + + // Apply a matte border to the top of tabbedPane - this places it between + // the topPanel (dropdown) and the tabs themselves. + tabbedPane.setBorder(BorderFactory.createMatteBorder(3, 0, 0, 0, targetColor)); + revalidate(); + repaint(); + } + /** * Updates tab style - highlights the active tab with bold font and color. */ diff --git a/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java b/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java index 91fc033..d820857 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java +++ b/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java @@ -960,17 +960,9 @@ public class MainWindow extends JFrame { Color selColor = config.getSelectionColor(); if (selColor == null) selColor = new Color(184, 207, 229); - // Inactive indicator is more subtle (darker) - Color inactiveColor = new Color(60, 60, 60); - - // We use a MatteBorder to create a "strip" only on the top edge - leftPanel.setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createMatteBorder(3, 0, 0, 0, activePanel == leftPanel ? selColor : inactiveColor), - BorderFactory.createEmptyBorder(3, 5, 5, 5))); - - rightPanel.setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createMatteBorder(3, 0, 0, 0, activePanel == rightPanel ? selColor : inactiveColor), - BorderFactory.createEmptyBorder(3, 5, 5, 5))); + // Delegate active state visualization to the panels themselves + leftPanel.setActive(activePanel == leftPanel, selColor); + rightPanel.setActive(activePanel == rightPanel, selColor); } /**