From 1c7e5d3e647e8bfde5c865493d92eb9b38572327 Mon Sep 17 00:00:00 2001 From: Radek Davidek Date: Wed, 28 Jan 2026 21:26:19 +0100 Subject: [PATCH] changed file editor/viewer behaviour --- src/main/java/cz/kamma/kfmanager/ui/FileEditor.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java b/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java index a256469..8d33b50 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java +++ b/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java @@ -15,7 +15,7 @@ import java.nio.file.Files; /** * Internal file editor/viewer */ -public class FileEditor extends JDialog { +public class FileEditor extends JFrame { private JTextArea textArea; private JScrollPane scrollPane; private File file; @@ -61,12 +61,16 @@ public class FileEditor extends JDialog { } public FileEditor(Window parent, File file, String virtualPath, AppConfig config, boolean readOnly) { - super(parent, (readOnly ? "Viewer - " : "Editor - ") + (virtualPath != null ? virtualPath.substring(virtualPath.lastIndexOf(File.separator) + 1) : file.getName()), ModalityType.MODELESS); + super((readOnly ? "Viewer - " : "Editor - ") + (virtualPath != null ? virtualPath.substring(virtualPath.lastIndexOf(File.separator) + 1) : file.getName())); this.file = file; this.virtualPath = virtualPath; this.config = config; this.readOnly = readOnly; + // Set window properties for non-modal window + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + setLocationRelativeTo(parent); + if (isImageFile(file) && virtualPath == null) { initImageList(); } @@ -85,7 +89,6 @@ public class FileEditor extends JDialog { } // Intercept window close (X) so we run the same save-confirm flow as other close actions - setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) {