Is it possible to distinguish the appearance for different panels in the same frame?

Let's say I have 3 panels added to the frame, and for the 1st panel I want to set the metal look, for the second panel I want the windows to look and look, for the third panel it should be the default swing style.

Is it possible?

+4
source share
4 answers

The javax.swing.UIManager class, where the appearance is set, is a singleton. Only one can be installed at any given time.

However, you can (if you are so inclined) override UI delegates for individual components (see JComponent.setUI () ). Using this method, you could probably hack some of the components that the delegates of the user interface of an alternative view and feelings use. But in most cases, they will look for UIDefaults set by the "real" appearance, so, at best, it will be a bad approximation.

+5
source

No, It is Immpossible.

+1
source

Actually it’s possible, it’s happening to me right now. In my GUI class, I called

 UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel") 

For some reason, the container panel is still metal, and all other components are a halo.

0
source

How about loading UIManager.setLookAndFeel in another classloader?

Didn't it work?

I think if this works, you will need to collate the data between the class loaders. I think Google wrote such a bridge.

0
source

Source: https://habr.com/ru/post/1308016/


All Articles