Cleanup TabComponent Close Pane

This commit is contained in:
Konloch 2024-09-25 20:31:02 -06:00
parent 68da280933
commit 88ae27a94a

AI 샘플 코드 생성 중입니다

Loading...

View File

@ -70,10 +70,7 @@ public class TabComponent extends JPanel {
if (e.getButton() != MouseEvent.BUTTON1) // left-click
return;
if (pane.indexOfTabComponent(TabComponent.this) != -1) {
int i = pane.indexOfTabComponent(TabComponent.this);
removeTab(i);
}
closePane();
}));
closeTab.addActionListener(e ->
@ -86,7 +83,6 @@ public class TabComponent extends JPanel {
closeAllTabs.addActionListener(e ->
{
while (true) {
if (pane.getTabCount() <= 1)
return;
@ -101,7 +97,16 @@ public class TabComponent extends JPanel {
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}
public void closePane()
{
if (pane.indexOfTabComponent(TabComponent.this) != -1)
{
int i = pane.indexOfTabComponent(TabComponent.this);
removeTab(i);
}
}
private void removeTab(int index) {
ResourceViewer resourceViewer = (ResourceViewer) BytecodeViewer.viewer.workPane.tabs.getComponentAt(index);
BytecodeViewer.viewer.workPane.openedTabs.remove(resourceViewer.resource.workingName);