JBTabbedPane UI replaced after theme switch

Answered

Hello. Would you help me fix a problem

I added a toolwindow by a plugin with JBTabbedPane in it.

When a user switches the theme from Intellij to Darcula and back (or vice-versa), IDE gets side UI instead of my class.

Steps to reproduce:

0. https://github.com/yrakovets/tabbedPaneTest.git

1. task runIDE

2. open project

3. change the theme to Darcula and apply

4. change the theme to Intellij and apply

 

Expected: JBTabbedPane UI will be similar after 2nd step and after 4th step

Actual :

 

3 comments
Comment actions Permalink

For toolwindows one would usually use builtin functionality for tabs, com.intellij.ui.content.ContentManager#addContent(com.intellij.ui.content.Content) where each Content represents one separate tab. Does it work for you?

0
Comment actions Permalink

I used that class

https://github.com/yrakovets/tabbedPaneTest/blob/master/src/main/java/com/yr/RequestPanelFactory.java

 

I made the fix for my problem. It doesn't work correctly in the sample, but in my project it does. I "return" the UI back in PropertyChangeListener) 

pane.addPropertyChangeListener(evt -> {
if (!pane.getUI().equals(ui)) {
pane.setUI(ui);
}
});

The question can be marked as answered, but as for me, IDE behavior is incorrect

0
Comment actions Permalink

This behaviour is expected, on switching look-n-feel every component get UI according to LookAndFeel. So you may override setUI() method and always set your own special UI there instead of original one.

0

Please sign in to leave a comment.