From cabaa8e6e6e024e4e093298f733cc81cc1395027 Mon Sep 17 00:00:00 2001 From: rdavidek Date: Sun, 22 Mar 2026 18:15:56 +0100 Subject: [PATCH] fixed focus in binary/hex mode --- src/main/java/cz/kamma/kfmanager/ui/FileEditor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java b/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java index 5e01665..75308f0 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java +++ b/src/main/java/cz/kamma/kfmanager/ui/FileEditor.java @@ -810,6 +810,7 @@ public class FileEditor extends JFrame { } hexControlPanel.setVisible(true); northPanel.revalidate(); + SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow()); } else { // switch back to text view if possible // close RA if open @@ -971,6 +972,7 @@ public class FileEditor extends JFrame { if (hexControlPanel.getParent() == null) northPanel.add(hexControlPanel); hexControlPanel.setVisible(true); northPanel.revalidate(); + SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow()); } else if (hexMode) { buildHexViewText(0L); } else { @@ -1024,6 +1026,7 @@ public class FileEditor extends JFrame { textArea.setEditable(false); textArea.setFont(new Font("Monospaced", Font.PLAIN, textArea.getFont().getSize())); hexMode = true; + SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow()); } else { // Small or text file: load fully fileBytes = Files.readAllBytes(file.toPath()); @@ -1037,6 +1040,7 @@ public class FileEditor extends JFrame { if (hexControlPanel.getParent() == null) northPanel.add(hexControlPanel); hexControlPanel.setVisible(true); northPanel.revalidate(); + SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow()); } else if (hexMode) { buildHexViewText(0L); } else {