Bugfix to restore ClosableTabComponent properly.
This commit is contained in:
parent
cd147d18be
commit
c2e37929da
@ -183,6 +183,7 @@ class ClosableTabComponent extends JPanel {
|
|||||||
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
|
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
|
||||||
//tab button
|
//tab button
|
||||||
JButton button = new TabButton();
|
JButton button = new TabButton();
|
||||||
|
|
||||||
add(button);
|
add(button);
|
||||||
//add more space to the top of the component
|
//add more space to the top of the component
|
||||||
setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
|
setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
|
||||||
@ -215,6 +216,7 @@ class ClosableTabComponent extends JPanel {
|
|||||||
final String tabTitle = pane.getTitleAt(i);
|
final String tabTitle = pane.getTitleAt(i);
|
||||||
final Component tabPane = pane.getComponentAt(i);
|
final Component tabPane = pane.getComponentAt(i);
|
||||||
final int tabPosition = i;
|
final int tabPosition = i;
|
||||||
|
|
||||||
pane.remove(i);
|
pane.remove(i);
|
||||||
if(pane.getTabCount() == 0) {
|
if(pane.getTabCount() == 0) {
|
||||||
pane.setVisible(false);
|
pane.setVisible(false);
|
||||||
@ -228,7 +230,10 @@ class ClosableTabComponent extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
/* Add the Tab Panel again */
|
/* Add the Tab Panel again */
|
||||||
|
// ToDo: Fix indexing problem
|
||||||
pane.insertTab(tabTitle, null, tabPane, "", tabPosition);
|
pane.insertTab(tabTitle, null, tabPane, "", tabPosition);
|
||||||
|
/* Set the tab component (closable) */
|
||||||
|
pane.setTabComponentAt(tabPosition, ClosableTabComponent.this);
|
||||||
pane.setVisible(true);
|
pane.setVisible(true);
|
||||||
/* Remove the Button */
|
/* Remove the Button */
|
||||||
toolBar.remove((Component)e.getSource());
|
toolBar.remove((Component)e.getSource());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user