tags:

views:

495

answers:

1

I want to completely change the look of a scollbar but overriding JScrollBar and the paintComponent method doesn't work, the track and thumb are painted but the left and right arrows stay the same.
I am also using them inside a JScrollPane and using
setHorizontalScrollBar( new CustomScrollBar() ) to set the scroll bars to my custom scroll bars but it doesn't work so well, the horizontal scrollbar doesn't change it's orientation, it doesn't change to a vertical scroll bar.

How do I paint a completely new JScrollBar and use it within a JScrollPane?

+3  A: 

In a nutshell you need to subclass ScrollBarUI with your own implementation and then register it with the UIManager.

There's a full article here.

Adamski
It looks like a good article but I was hoping for something simpler.That method actually creates an entirely new scrollbar, it defines completely new functionality.All I want is to change the look, the rest of the scrollbar must stay exactly the same.
cmann