0

I have a JScrollPane containing a JTextArea. I know how to change the color of the thumb and the track of the ScrollPane's scrollbar but want to either change the color of the arrow buttons as well or delete them. (Rather change, if it is possible). Do you know a way to do that? (A hint to the needed attribute and where I can find it is more than enough for me, you dont have to factorize a whole program.)

Luqus
  • 109
  • 1
  • 11
  • 2
    *"change the color of the thumb and the track"* I'd reckon a (possibly custom) PLAF or mucking about with the `UIManager` / `UIDefaults`. I'd also reckon time would be better spent on making a robust, resizable, intuitive GUI. – Andrew Thompson Jan 20 '22 at 15:39
  • Could you please give me an example on how to do that? – Luqus Jan 20 '22 at 15:48
  • 1
    Try the answer to ["change colour of scrollbar end buttons"](https://stackoverflow.com/a/11074304/16653700). – Alias Cartellano Jan 20 '22 at 22:54
  • Works fine for the background, but I can't figure out how to change the color of the arrow icon. – Luqus Jan 21 '22 at 09:01
  • 1
    To [remove the arrow buttons set the dimensions of the arrow buttons to 0](https://stackoverflow.com/questions/1786886/remove-arrows-from-swing-scrollbar-in-jscrollpane). Try changing the icons of the buttons: create a new UI as shown in the link I sent previously and overwrite `super.createDecreaseButton(orientation);` and `super.createIncreaseButton(orientation);` with `new JButton();`. You can then change the buttons using `button.setIcon(ImageIcon)`, you may need to modify their dimensions. You'll be able to modify the arrows as you want, but you'll have to make them yourself. – Alias Cartellano Jan 21 '22 at 22:21

0 Answers0