How can I set the UI for all components in my application without having to reference each one of them using component.setUI(...);
?
For example, I have several custom JScrollbars
throughout my program,
and when you switch to another theme I have to reset all the UI's like this: scrollPane.getVerticalScrollBar().setUI(new CustomScrollBarUI());
I would prefer to not have to look up each one seperately when changing themes. Is there a way to do this?
You can change the
UIDefaults
early in your program:See also Changing UI Default Settings in Java: The UIDefaults Class.