Skip to content

Commit

Permalink
Merge pull request #492 from dozmus/features/fix-right-click-close
Browse files Browse the repository at this point in the history
fix right-clicking close tab button closes popup menu
  • Loading branch information
Konloch committed Apr 9, 2024
2 parents 2a9fafd + 6d37e3e commit 0d8206e
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -6,6 +6,7 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;

public class CloseButtonComponent extends JPanel {

Expand Down Expand Up @@ -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));
}));
Expand Down

0 comments on commit 0d8206e

Please sign in to comment.