I want to change the JScrollPane Scrollbar color to black. I tried to make the change using UIManger. but found nothing.
To change the background color of the scroll bar, you can do this:
scrollPane.getVerticalScrollBar().setBackground(Color.BLACK);
scrollPane.getHorizontalScrollBar().setBackground(Color.BLACK);
To change the color of the scrollbar itself, use the following code:
import javax.swing.plaf.basic.BasicScrollBarUI;
scrollPane.getVerticalScrollBar().setUI(new BasicScrollBarUI() {
@Override
protected void configureScrollBarColors() {
this.thumbColor = Color.BLACK;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With