19
19
* */
20
20
21
21
public class MaterialScrollBarUI extends BasicScrollBarUI {
22
+
23
+ private static boolean DEBUG = false ;
22
24
23
25
public static ComponentUI createUI (JComponent c ) {
24
26
return new MaterialScrollBarUI ();
@@ -38,10 +40,23 @@ public void installUI (JComponent c) {
38
40
public void paint (Graphics g , JComponent c ) {
39
41
super .paint (MaterialDrawingUtils .getAliasedGraphics (g ), c );
40
42
}
41
-
43
+
44
+ /**
45
+ * @author https://github.com/vincenzopalazzo
46
+ * The method takes an integer variable that for the createDecreaseButton
47
+ * method takes 7 if the scrollbar is horizontal and 1 if vertical
48
+ */
42
49
@ Override
43
50
protected JButton createDecreaseButton (int orientation ) {
44
- JButton button = new JButton (new ImageIcon (MaterialImages .UP_ARROW ));
51
+ JButton button = new JButton ();
52
+ if (DEBUG == true ) System .out .println ("orientation decrese: " + orientation );
53
+ if (orientation == 7 ) {
54
+ if (DEBUG == true ) System .out .println ("orientation decrese down: " + orientation );
55
+ button = new JButton (new ImageIcon (MaterialImages .LEFTH_ARROW ));
56
+ }else {
57
+ if (DEBUG == true ) System .out .println ("orientation decrese right: " + orientation );
58
+ button = new JButton (new ImageIcon (MaterialImages .UP_ARROW ));
59
+ }
45
60
46
61
button .setOpaque (true );
47
62
button .setBackground (MaterialColors .GRAY_300 );
@@ -50,10 +65,22 @@ protected JButton createDecreaseButton (int orientation) {
50
65
return button ;
51
66
}
52
67
68
+ /**
69
+ * @author https://github.com/vincenzopalazzo
70
+ * The method takes an integer variable that for the createIncreaseButton
71
+ * method takes 5 if the scrollbar is horizontal and 3 if vertical
72
+ */
53
73
@ Override
54
74
protected JButton createIncreaseButton (int orientation ) {
55
- JButton button = new JButton (new ImageIcon (MaterialImages .DOWN_ARROW ));
56
-
75
+ JButton button = new JButton ();
76
+ if (DEBUG == true ) System .out .println ("orientation increse: " + orientation );
77
+ if (orientation == 5 ) {
78
+ if (DEBUG == true ) System .out .println ("orientation decrese up: " + orientation );
79
+ button = new JButton (new ImageIcon (MaterialImages .DOWN_ARROW ));
80
+ }else {
81
+ if (DEBUG == true ) System .out .println ("orientation decrese lefth: " + orientation );
82
+ button = new JButton (new ImageIcon (MaterialImages .RIGHT_ARROW ));
83
+ }
57
84
button .setOpaque (true );
58
85
button .setBackground (MaterialColors .GRAY_300 );
59
86
button .setBorder (BorderFactory .createEmptyBorder ());
0 commit comments