Skip to content

Commit 050aa89

Browse files
fix scrollbar bug icon
2 parents 8dbc773 + 3ac9068 commit 050aa89

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

src/imgs/lefth_arrow.png

147 Bytes
Loading

src/mdlaf/components/scrollbar/MaterialScrollBarUI.java

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* */
2020

2121
public class MaterialScrollBarUI extends BasicScrollBarUI {
22+
23+
private static boolean DEBUG = false;
2224

2325
public static ComponentUI createUI (JComponent c) {
2426
return new MaterialScrollBarUI ();
@@ -38,10 +40,23 @@ public void installUI (JComponent c) {
3840
public void paint (Graphics g, JComponent c) {
3941
super.paint (MaterialDrawingUtils.getAliasedGraphics (g), c);
4042
}
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+
*/
4249
@Override
4350
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+
}
4560

4661
button.setOpaque (true);
4762
button.setBackground (MaterialColors.GRAY_300);
@@ -50,10 +65,22 @@ protected JButton createDecreaseButton (int orientation) {
5065
return button;
5166
}
5267

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+
*/
5373
@Override
5474
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+
}
5784
button.setOpaque (true);
5885
button.setBackground (MaterialColors.GRAY_300);
5986
button.setBorder (BorderFactory.createEmptyBorder ());

src/mdlaf/resources/MaterialImages.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
public class MaterialImages {
1111

1212
public static final BufferedImage RIGHT_ARROW = loadImg ("/imgs/right_arrow.png");
13+
public static final BufferedImage LEFTH_ARROW = loadImg ("/imgs/lefth_arrow.png");
1314
public static final BufferedImage DOWN_ARROW = loadImg ("/imgs/down_arrow.png");
1415
public static final BufferedImage UP_ARROW = loadImg ("/imgs/up_arrow.png");
1516
public static final BufferedImage PAINTED_CHECKED_BOX = loadImg ("/imgs/painted_checked_box.png");

0 commit comments

Comments
 (0)