This commit is contained in:
Radek Davidek 2026-01-16 15:37:10 +01:00
parent b3b64f36fa
commit 61fb75854e
4 changed files with 38 additions and 11 deletions

View File

@ -8,6 +8,8 @@ import javax.swing.*;
* Hlavní třída aplikace KF File Manager
*/
public class MainApp {
public static final String APP_VERSION = "0.0.2";
public static void main(String[] args) {
// Nastavení look and feel podle systému

View File

@ -148,8 +148,11 @@ public class FilePanel extends JPanel {
tabbedPane = new JTabbedPane();
tabbedPane.setTabPlacement(JTabbedPane.TOP);
// Listener pro aktualizaci cesty při změně tabu
tabbedPane.addChangeListener(e -> updatePathField());
// Listener pro aktualizaci cesty a stylu při změně tabu
tabbedPane.addChangeListener(e -> {
updatePathField();
updateTabStyles();
});
add(tabbedPane, BorderLayout.CENTER);
}
@ -195,6 +198,7 @@ public class FilePanel extends JPanel {
// Aktualizovat path field
updatePathField();
updateTabStyles();
// Nastavit focus na tabulku v novém tabu
SwingUtilities.invokeLater(() -> {
@ -222,6 +226,7 @@ public class FilePanel extends JPanel {
tabbedPane.setSelectedComponent(tab);
updatePathField();
updateTabStyles();
SwingUtilities.invokeLater(() -> {
tab.getFileTable().requestFocusInWindow();
@ -300,6 +305,7 @@ public class FilePanel extends JPanel {
}
updatePathField();
updateTabStyles();
}
private void populateDrives() {
@ -341,12 +347,31 @@ public class FilePanel extends JPanel {
* Update the title of a tab according to its current directory
*/
private void updateTabTitle(FilePanelTab tab) {
int index = tabbedPane.indexOfComponent(tab);
if (index >= 0) {
File currentDir = tab.getCurrentDirectory();
if (currentDir != null) {
String title = getTabTitle(currentDir.getAbsolutePath());
tabbedPane.setTitleAt(index, title);
updateTabStyles();
}
/**
* Aktualizuje styl tabů - zvýrazní aktivní tab tučným písmem a barvou.
*/
private void updateTabStyles() {
if (tabbedPane == null) return;
int selectedIndex = tabbedPane.getSelectedIndex();
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
Component c = tabbedPane.getComponentAt(i);
if (c instanceof FilePanelTab) {
FilePanelTab tab = (FilePanelTab) c;
File dir = tab.getCurrentDirectory();
String title = getTabTitle(dir != null ? dir.getAbsolutePath() : "");
if (i == selectedIndex) {
// Aktivní tab: tučné písmo a tmavě modrá barva
tabbedPane.setTitleAt(i, "<html><b>" + title + "</b></html>");
tabbedPane.setForegroundAt(i, new Color(0, 51, 153));
} else {
// Neaktivní tab: normální písmo a výchozí barva
tabbedPane.setTitleAt(i, title);
tabbedPane.setForegroundAt(i, null);
}
}
}
}
@ -359,6 +384,7 @@ public class FilePanel extends JPanel {
if (index >= 0 && tabbedPane.getTabCount() > 1) {
tabbedPane.removeTabAt(index);
updatePathField();
updateTabStyles();
// Set focus to the table in the newly active tab
FilePanelTab currentTab = getCurrentTab();

View File

@ -1,5 +1,6 @@
package com.kfmanager.ui;
import com.kfmanager.MainApp;
import com.kfmanager.config.AppConfig;
import com.kfmanager.model.FileItem;
import com.kfmanager.service.FileOperations;
@ -22,10 +23,8 @@ public class MainWindow extends JFrame {
private JTextField commandLine;
private AppConfig config;
private static final String APP_VERSION = "0.0.1";
public MainWindow() {
super("KF Manager v" + APP_VERSION);
super("KF Manager v" + MainApp.APP_VERSION);
// Load configuration
config = new AppConfig();

BIN
src/main/resources/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB