Tabs: Include pane.remove into removeTab method.

This commit is contained in:
Cody 2024-04-13 12:20:28 -06:00
parent f6bacdacef
commit cdb6573ca4

AI 샘플 코드 생성 중입니다

Loading...

View File

@ -12,12 +12,16 @@ import java.awt.event.MouseEvent;
public class TabComponent extends JPanel {
private JTabbedPane pane;
public TabComponent(final JTabbedPane pane) {
super(new FlowLayout(FlowLayout.LEFT, 0, 0));
if (pane == null) {
throw new NullPointerException("TabbedPane is null");
}
this.pane = pane;
setOpaque(false);
JLabel label = new JLabel() {
public String getText() {
@ -51,7 +55,6 @@ public class TabComponent extends JPanel {
if (pane.indexOfTabComponent(TabComponent.this) != -1) {
int i = pane.indexOfTabComponent(TabComponent.this);
removeTab(i);
pane.remove(pane.indexOfTabComponent(TabComponent.this));
}
}));
@ -60,7 +63,6 @@ public class TabComponent extends JPanel {
if (pane.indexOfTabComponent(TabComponent.this) != -1) {
int i = pane.indexOfTabComponent(TabComponent.this);
removeTab(i);
pane.remove(pane.indexOfTabComponent(TabComponent.this));
}
});
@ -73,10 +75,8 @@ public class TabComponent extends JPanel {
if (pane.indexOfTabComponent(TabComponent.this) != 0) {
removeTab(0);
pane.remove(0);
} else {
removeTab(1);
pane.remove(1);
}
}
});
@ -87,6 +87,7 @@ public class TabComponent extends JPanel {
private void removeTab(int index) {
ResourceViewer resourceViewer = (ResourceViewer) BytecodeViewer.viewer.workPane.tabs.getComponentAt(index);
BytecodeViewer.viewer.workPane.openedTabs.remove(resourceViewer.resource.workingName);
pane.remove(index);
}
}