Skip to content

Commit 218de05

Browse files
committed
Enabled tabs to be rearranged. Did not add functionality for a tab to be dropped out. We could possibly add it at a later time, also add a setting to toggle it on/off? Recommend to gather feedback to see if that is something wanted.
1 parent e4e511b commit 218de05

6 files changed

Lines changed: 884 additions & 221 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
public class BytecodeViewer
131131
{
132132
//TODO fix this for tab dragging & better tab controls
133-
public static boolean EXPERIMENTAL_TAB_CODE = false;
133+
public static boolean EXPERIMENTAL_TAB_CODE = true;
134134

135135
//the launch args called on BCV
136136
public static String[] launchArgs;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package the.bytecode.club.bytecodeviewer.gui.resourceviewer;
2+
3+
import com.android.tools.r8.internal.Cl;
4+
import com.github.weisj.darklaf.components.CloseButton;
5+
6+
import javax.swing.*;
7+
import java.awt.*;
8+
9+
public class CloseButtonComponent extends JPanel {
10+
11+
private final JTabbedPane pane;
12+
13+
public CloseButtonComponent(final JTabbedPane pane) {
14+
super(new FlowLayout(FlowLayout.LEFT, 0, 0));
15+
if (pane == null) {
16+
throw new NullPointerException("TabbedPane is null");
17+
}
18+
19+
this.pane = pane;
20+
setOpaque(false);
21+
JLabel label = new JLabel() {
22+
public String getText() {
23+
int i = pane.indexOfTabComponent(CloseButtonComponent.this);
24+
if (i != -1) {
25+
return pane.getTitleAt(i);
26+
}
27+
28+
return null;
29+
}
30+
};
31+
32+
add(label);
33+
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
34+
JButton button = new CloseButton();
35+
add(button);
36+
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
37+
}
38+
39+
}

0 commit comments

Comments
 (0)