-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
6 changed files
with
884 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
|
||
} |
Oops, something went wrong.