Added simple close button to tab component
This commit is contained in:
parent
c6db7da698
commit
baf55a4c96
@ -2,6 +2,7 @@ package dev.kske.chess.ui;
|
|||||||
|
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTabbedPane;
|
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