From ede34d3b88a3828fad82119be9ccd386b59bbc06 Mon Sep 17 00:00:00 2001 From: Pedro Dias Date: Thu, 11 Apr 2024 20:02:46 -0300 Subject: [PATCH] fix(bytecodeviewer.BytecodeViewer): Temporary solution for someone that have this same problem Revalidate and repaint components when mouse events occurs, this is an simple solution for all disappearing when mouse hover into things. --- .../club/bytecodeviewer/BytecodeViewer.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 236790040..7b2a379e4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -295,6 +295,12 @@ public static void boot(boolean cli) if (launchArgs.length >= 1) for (String s : launchArgs) openFiles(new File[]{new File(s)}, true); + + if (!cli) + Toolkit.getDefaultToolkit().addAWTEventListener( + event -> BytecodeViewer.refreshUI(), + AWTEvent.MOUSE_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK | AWTEvent.ACTION_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK + ); } /** @@ -772,6 +778,17 @@ public static void updateAllFonts(Font font) { } } + /** + * Revalidate and repaints components. + */ + public static void refreshUI() { + viewer.revalidate(); + viewer.repaint(); + + viewer.workPane.revalidate(); + viewer.workPane.repaint(); + } + /** * Updates all swing components. */