我可以在同一个 Swing 应用程序中使用两种不同的外观吗?
我正在使用 Flamingo 功能区和 Substance Office 2007 外观。
当然,现在每个控件都有这种外观和感觉,即使是对话框上的控件也是如此。
我想要的是类似于 Office 2007 的功能,其中功能区具有 Office 2007 的外观,但其他控件保持其本机 Vista/XP 的外观。
是否可以为某些控件分配不同的外观和感觉? 也许使用某种链接或代理外观和感觉?
I'm using the Flamingo ribbon and the Substance Office 2007 look and feel.
Of course now every control has this look and feel, even those on dialog boxes.
What I want is something like in Office 2007, where the ribbons have their Office 2007 look, but other controls keep their native Vista/XP look.
Is it possible to assign certain controls a different look and feel? Perhaps using some kind of chaining or a proxy look and feel?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我刚刚发现:自从 Substance 5.0 以来,SKIN_PROPERTY 可用。
它允许将不同的皮肤分配给不同的
JRootPanes
(即JDialog
、JFrame
、JInternalFrame
)一个小技巧:我覆盖
JInternalFrame
删除多余的边框和标题窗格,使其看起来像无边框面板。 这样就可以给人留下这样的印象:表单/对话框的不同部分具有不同的外观。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.这是一个会自动改变外观的库。 我不确定这是否会以不同的方式为每个组件完成,但你应该看一下。 pbjar.org
如果您想深入了解外观和感觉,这本书应该很有用/java-look-and-feel -design-guidelines-second-edition
我很高兴看到一些代码示例,如果有人可以编写它,请随意开始。
编辑:
在此论坛主题中主题 我发现了以下描述
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 在幕后做了很多“伪全局”的事情。 AFAIK,一致地执行此操作的唯一方法是使用私有
AppContext
API。 每个 AppContext 都有自己的事件调度线程和其他“伪全局变量”。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. EachAppContext
has its own event dispatch thread and other "psuedo-globals".