Search code examples
javaswingjscrollbar

Java - How can I change a JScrollBar's buttons dynamically?


I've overridden BasicScrollBarUI, but I don't know how to change the buttons after they've been created. How could I do this? Thanks.


Solution

  • I think you need to do something like this:

    UIManager.put("ScrollBarUI", YourScrollbarUI.class.getName());
    SwingUtilities.updateComponentTreeUI(frame); 
    frame.pack();
    

    Take a look at this link for more information of how to update the Look and Feel. Look and Feel