Can I use two different look and feels in the same Swing application?

谁都会走 提交于 2019-11-28 08:40:52

I just discovered: Since Substance 5.0 the SKIN_PROPERTY is available.

It allows assigning different skins to different JRootPanes (i.e. JDialog, JFrame, JInternalFrame)

A little trick: I override JInternalFrame to remove the extra border and the title pane so that it looks just like a borderless panel. That way it is possible to create the impression, that different parts of a form/dialog have different looks.

Here is a library which will automaticaly change the look and feel. I am not sure it this will done for every component in a different way, but you should take a look at it. pbjar.org

This book should be useful if you want to go deep into look and feel /java-look-and-feel-design-guidelines-second-edition

I would be glad to see some code example, if someone can write it, feel free to get starting.

EDIT:

In this forum thread Thread i found the following description

Swing uses a Look & Feel (a PLAF). PLAFs aren't attached on a per-JFrame level. They are attached on a per-VM level. It is almost impossible to mix PLAFs within one application. I have seen a few attempts, all failed.

Swing unfortunately does lots of "psuedo-global" things behind the scenes. AFAIK, the only way to do it consistently is to use the private AppContext API. Each AppContext has its own event dispatch thread and other "psuedo-globals".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!