1
2
3
4
5
6
7
8
9
10
11 package com.jsql.view.swing.ui;
12
13 import com.jsql.view.swing.util.UiUtil;
14
15 import javax.swing.*;
16 import javax.swing.plaf.UIResource;
17 import javax.swing.plaf.basic.BasicArrowButton;
18 import javax.swing.plaf.metal.MetalTabbedPaneUI;
19 import java.awt.*;
20
21
22
23
24 public class BorderlessTabButtonUI extends MetalTabbedPaneUI {
25
26 @Override
27 protected JButton createScrollButton(int direction) {
28
29 if (direction != SOUTH && direction != NORTH && direction != EAST && direction != WEST) {
30
31 throw new IllegalArgumentException("Direction must be one of: SOUTH, NORTH, EAST or WEST");
32 }
33
34 return new ScrollableTabButton(direction);
35 }
36
37 private static class ScrollableTabButton extends BasicArrowButton implements UIResource, SwingConstants {
38
39 public ScrollableTabButton(int direction) {
40
41 super(
42 direction,
43 UiUtil.COLOR_DEFAULT_BACKGROUND,
44 UIManager.getColor("TabbedPane.darkShadow"),
45 new Color(122, 138, 153),
46 UIManager.getColor("TabbedPane.highlight")
47 );
48
49 this.setBorder(BorderFactory.createEmptyBorder());
50 this.setOpaque(false);
51 this.setBorderPainted(false);
52 }
53 }
54 }