Skip to content

Commit

Permalink
fix right-clicking close tab button closes popup menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dozmus committed Apr 8, 2024
1 parent 13bf3cd commit 6d37e3e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
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 6d37e3e

Please sign in to comment.