Added simple close button to tab component
This commit is contained in:
parent
17d2080e27
commit
cb79cc3159
@ -2,6 +2,7 @@ package dev.kske.chess.ui;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
@ -33,6 +34,11 @@ public class GameTabComponent extends JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: Add closing button
|
||||
JButton btnClose = new JButton("Close");
|
||||
btnClose.addActionListener((evt) -> {
|
||||
int i = tabbedPane.indexOfTabComponent(GameTabComponent.this);
|
||||
if (i != -1) tabbedPane.remove(i);
|
||||
});
|
||||
add(btnClose);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user