Your method actionPerformed()calls your method closeTab(). Your method closeTab()removes the currently selected tab from the tab bar.
, , .
Tab, , . actionPerformed() closeTab()
public void actionPerformed(ActionEvent e)
{
closeTab(component);
}
private void closeTab(JComponent component)
{
menuTabbedPane.remove(component);
}
:
tab = new Tab("The Label", component);
menuTabbedPane.insertTab(title, icon, component, tooltip, tabIndex);
menuTabbedPane.setTabComponentAt(tabIndex, tab);
Tab...
public Tab(String label, final JComponent component)
{
...
closeTab.addActionListener(new ActionListner()
{
public void actionPerformed(ActionEvent e)
{
closeTab(component);
}
});
...
}