From 6d37e3ed128212f05b470e5c1d6845888cd1ff29 Mon Sep 17 00:00:00 2001 From: PureCS Date: Thu, 28 Mar 2024 20:26:52 +0000 Subject: [PATCH] fix right-clicking close tab button closes popup menu --- .../gui/resourceviewer/CloseButtonComponent.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java index 70c41c37e..e6563dd8f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java @@ -6,6 +6,7 @@ import javax.swing.*; import java.awt.*; +import java.awt.event.MouseEvent; public class CloseButtonComponent extends JPanel { @@ -45,6 +46,9 @@ public String getText() { button.addMouseListener(new MouseClickedListener(e -> { + if (e.getButton() != MouseEvent.BUTTON1) // left-click + return; + if (pane.indexOfTabComponent(CloseButtonComponent.this) != -1) pane.remove(pane.indexOfTabComponent(CloseButtonComponent.this)); }));