Skip to content

Commit

Permalink
Enabled tabs to be rearranged. Did not add functionality for a tab to…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
Bl3nd committed Jan 24, 2023
1 parent e4e511b commit 218de05
Show file tree
Hide file tree
Showing 6 changed files with 884 additions and 221 deletions.
Expand Up @@ -130,7 +130,7 @@
public class BytecodeViewer
{
//TODO fix this for tab dragging & better tab controls
public static boolean EXPERIMENTAL_TAB_CODE = false;
public static boolean EXPERIMENTAL_TAB_CODE = true;

//the launch args called on BCV
public static String[] launchArgs;
Expand Down
@@ -0,0 +1,39 @@
package the.bytecode.club.bytecodeviewer.gui.resourceviewer;

import com.android.tools.r8.internal.Cl;
import com.github.weisj.darklaf.components.CloseButton;

import javax.swing.*;
import java.awt.*;

public class CloseButtonComponent extends JPanel {

private final JTabbedPane pane;

public CloseButtonComponent(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() {
int i = pane.indexOfTabComponent(CloseButtonComponent.this);
if (i != -1) {
return pane.getTitleAt(i);
}

return null;
}
};

add(label);
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
JButton button = new CloseButton();
add(button);
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}

}

0 comments on commit 218de05

Please sign in to comment.