Skip to content

Commit

Permalink
Application: Replace hand-crafted vertical tabs with FlatLaf ones
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Mar 14, 2024
1 parent 5c9ebc3 commit 78aff65
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.shade.util.NotNull;

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

public class ToolTabbedPane extends JTabbedPane {
Expand Down Expand Up @@ -64,18 +63,6 @@ public void minimizePane() {
repaint();
}

@Override
public void insertTab(String title, Icon icon, Component component, String tip, int index) {
super.insertTab(title, icon, component, tip, index);

if (tabPlacement == LEFT || tabPlacement == RIGHT) {
final VerticalLabel label = new VerticalLabel(title);
label.setClockwise(tabPlacement == RIGHT);
label.setIcon(icon);
setTabComponentAt(index, label);
}
}

private int computeMinimizedDividerLocation(@NotNull JSplitPane pane) {
return switch (tabPlacement) {
case LEFT, TOP -> TAB_HEADER_SIZE;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,6 @@ public void mouseExited(MouseEvent e) {
};
}

@SuppressWarnings("SuspiciousNameCombination")
@Override
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
if (tabPlacement == LEFT || tabPlacement == RIGHT) {
return tabHeight;
} else {
return super.calculateTabWidth(tabPlacement, tabIndex, metrics);
}

}

@SuppressWarnings("SuspiciousNameCombination")
@Override
protected Insets getTabInsets(int tabPlacement, int tabIndex) {
final Insets insets = super.getTabInsets(tabPlacement, tabIndex);

if (tabPlacement == LEFT || tabPlacement == RIGHT) {
return new Insets(insets.right, insets.top, insets.left, insets.bottom);
} else {
return insets;
}
}

private class CompactTabbedPaneLayout extends FlatTabbedPaneLayout {
@Override
protected boolean isContentEmpty() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ RangeSliderUI = com.shade.platform.ui.controls.plaf.FlatRangeSliderUI
TreeUI = com.shade.platform.ui.controls.tree.TreeUI
ToolTipUI = com.shade.platform.ui.controls.plaf.FlatOutlineToolTipUI
ToolTabbedPaneUI = com.shade.platform.ui.controls.plaf.FlatToolTabbedPaneUI
VerticalLabelUI = com.shade.platform.ui.controls.plaf.FlatVerticalLabelUI
LabeledSeparatorUI = com.shade.platform.ui.controls.plaf.LabeledSeparatorUI
ThinSplitPaneUI = com.shade.platform.ui.controls.plaf.FlatThinSplitPaneUI

#General
TitlePane.unifiedBackground = false
TitlePane.buttonSize = 44,28
TabbedPane.tabHeight = 24
TabbedPane.tabRotation = auto
Component.hideMnemonics = false
Tree.showsRootHandles = true
SplitPane.dividerSize = 7
Expand Down

0 comments on commit 78aff65

Please sign in to comment.