fixed focus in binary/hex mode

This commit is contained in:
rdavidek 2026-03-22 18:15:56 +01:00
parent a1b110628a
commit cabaa8e6e6

View File

@ -810,6 +810,7 @@ public class FileEditor extends JFrame {
} }
hexControlPanel.setVisible(true); hexControlPanel.setVisible(true);
northPanel.revalidate(); northPanel.revalidate();
SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow());
} else { } else {
// switch back to text view if possible // switch back to text view if possible
// close RA if open // close RA if open
@ -971,6 +972,7 @@ public class FileEditor extends JFrame {
if (hexControlPanel.getParent() == null) northPanel.add(hexControlPanel); if (hexControlPanel.getParent() == null) northPanel.add(hexControlPanel);
hexControlPanel.setVisible(true); hexControlPanel.setVisible(true);
northPanel.revalidate(); northPanel.revalidate();
SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow());
} else if (hexMode) { } else if (hexMode) {
buildHexViewText(0L); buildHexViewText(0L);
} else { } else {
@ -1024,6 +1026,7 @@ public class FileEditor extends JFrame {
textArea.setEditable(false); textArea.setEditable(false);
textArea.setFont(new Font("Monospaced", Font.PLAIN, textArea.getFont().getSize())); textArea.setFont(new Font("Monospaced", Font.PLAIN, textArea.getFont().getSize()));
hexMode = true; hexMode = true;
SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow());
} else { } else {
// Small or text file: load fully // Small or text file: load fully
fileBytes = Files.readAllBytes(file.toPath()); fileBytes = Files.readAllBytes(file.toPath());
@ -1037,6 +1040,7 @@ public class FileEditor extends JFrame {
if (hexControlPanel.getParent() == null) northPanel.add(hexControlPanel); if (hexControlPanel.getParent() == null) northPanel.add(hexControlPanel);
hexControlPanel.setVisible(true); hexControlPanel.setVisible(true);
northPanel.revalidate(); northPanel.revalidate();
SwingUtilities.invokeLater(() -> textArea.requestFocusInWindow());
} else if (hexMode) { } else if (hexMode) {
buildHexViewText(0L); buildHexViewText(0L);
} else { } else {