Browse Source

Fixed tabarea border not respecting insets.

pull/127/head
weisj 5 years ago
parent
commit
93797a27ee
  1. 21
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUI.java

21
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUI.java

@ -215,7 +215,9 @@ public class DarkTabbedPaneUI extends DarkTabbedPaneUIBridge {
@Override @Override
protected void paintTabArea(final Graphics g, final int tabPlacement, final int selectedIndex) { protected void paintTabArea(final Graphics g, final int tabPlacement, final int selectedIndex) {
paintTabAreaBackground(g, tabPlacement); if (tabPane.isOpaque()) {
paintTabAreaBackground(g, tabPlacement);
}
paintTabAreaBorder(g, tabPlacement); paintTabAreaBorder(g, tabPlacement);
super.paintTabArea(g, tabPlacement, selectedIndex); super.paintTabArea(g, tabPlacement, selectedIndex);
} }
@ -385,20 +387,23 @@ public class DarkTabbedPaneUI extends DarkTabbedPaneUIBridge {
private void paintTabAreaBorder(final Graphics g, final int tabPlacement) { private void paintTabAreaBorder(final Graphics g, final int tabPlacement) {
int width = tabPane.getWidth(); int width = tabPane.getWidth();
int height = tabPane.getHeight(); int height = tabPane.getHeight();
int y = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); Insets ins = tabPane.getInsets();
int x = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); int h = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight);
int w = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth);
switch (tabPlacement) { switch (tabPlacement) {
case TOP: case TOP:
paintTabAreaBorder(g, tabPlacement, 0, 0, width, y + 1); paintTabAreaBorder(g, tabPlacement, ins.left, 0, width - ins.left - ins.right, h + ins.top);
break; break;
case BOTTOM: case BOTTOM:
paintTabAreaBorder(g, tabPlacement, 0, height - y, width, y + 1); paintTabAreaBorder(g, tabPlacement, ins.left, height - h - ins.top, width - ins.left - ins.right,
h + ins.top + 1);
break; break;
case LEFT: case LEFT:
paintTabAreaBorder(g, tabPlacement, 0, 0, x, height); paintTabAreaBorder(g, tabPlacement, 0, ins.top, w + ins.left, height - ins.top - ins.bottom);
break; break;
case RIGHT: case RIGHT:
paintTabAreaBorder(g, tabPlacement, width - x, 0, x, height); paintTabAreaBorder(g, tabPlacement, width - w - ins.right, ins.top, w + ins.right,
height - ins.top - ins.bottom);
break; break;
} }
} }
@ -524,7 +529,7 @@ public class DarkTabbedPaneUI extends DarkTabbedPaneUIBridge {
} }
protected Color getTabAreaBackground() { protected Color getTabAreaBackground() {
return tabAreaBackground; return tabPane.isBackgroundSet() ? tabPane.getBackground() : tabAreaBackground;
} }
protected void paintDrop(final Graphics g) { protected void paintDrop(final Graphics g) {

Loading…
Cancel
Save