Implementing a closing button for game pane tabs #17

Merged
CyB3RC0nN0R merged 3 commits from f/close_tabs into master 2019-12-11 21:26:39 +01:00
Showing only changes of commit cb79cc3159 - Show all commits

View File

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