Change icon of a JButton when change the theme

I have developed a plugin with tool window. I want to change one of tool bar button icon when change the theme. how can i write theme change listener and make theme wise UI changes with out IDE re-start.

0

You might want to take a look at LafManagerListener, EditorColorsListener and UISettingsListener.

Also, if you want to use different icon under darcula, you can just put it near the default one. IconLoader.getIcon will return wrapper that would use the right one.

my_icon.png // light normal
my_icon_dark.png // dark normal
my_icon@2x.png // light hidpi (twice the size of the original)
my_icon@2x_dark.png // dark hidpi
1

请先登录再写评论。