From f4991abeb2255e1a35a10ae6a3c70d3922cb2636 Mon Sep 17 00:00:00 2001 From: Pavel Braginskiy Date: Tue, 7 Jan 2025 01:32:20 -0800 Subject: [PATCH] Close tabs by middle-clicking them --- megameklab/src/megameklab/ui/MegaMekLabTabbedUI.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/megameklab/src/megameklab/ui/MegaMekLabTabbedUI.java b/megameklab/src/megameklab/ui/MegaMekLabTabbedUI.java index a8dcda781..aeca7bdce 100644 --- a/megameklab/src/megameklab/ui/MegaMekLabTabbedUI.java +++ b/megameklab/src/megameklab/ui/MegaMekLabTabbedUI.java @@ -553,6 +553,18 @@ public void mouseClicked(MouseEvent e) { } } }); + + addMouseListener( + new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + // middle click to close tab + if (e.getButton() == MouseEvent.BUTTON2 && editor.safetyPrompt()) { + closeTabAt(editors.indexOf(editor)); + } + } + } + ); } }