Java的改变挥杆的背景颜色? [英] Java- Changing swing background colour?

查看:194
本文介绍了Java的改变挥杆的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确定这样的香港专业教育学院有一个Swing应用程序使用系统外观和感觉去。现在,我想改变主面板黑色的背景色。太简单了吧?

Ok so ive got a swing app going using the "System" look and feel. Now, I want to change the background colour of the main panels to black. Too easy right?

UIManager.put("Panel.background", Color.BLACK);

好耶,除了现在在应用程序中的控件看起来愚蠢的,因为他们的'影子',对于一个更好的词想,都毕业了对旧系统默认颜色(毛窗户灰色)褪色。因此,有对所有控制浅灰色的角落,尤其是在JTabbedPane中的选项卡。
我知道这是可以固定的,因为如果你用不同的默认应用程序的颜色改变WindowsXP的主题之一,​​控制担当这个变了颜色和自己的影子'褪色'朝它。

Well yeah, except now the controls in the app look stupid, because their 'shadows', for want of a better word, are graduated to fade towards the old system default colour(gross windows grey). So there are light grey 'corners' on all the controls, especially the tabs on JTabbedPane. I know it can be fixed, because if you change the windowsXP theme to one with a different default application colour, the controls take on this changed colour and their shadows 'fade' towards it.

但我不知道是什么UIManager的键入它,或者即使你可以用UIManger做到这一点。

But I have no idea what UIManager key it is, or even if you can do it with UIManger.

我真的不希望改变L&安培;˚F引擎,因为除了这个看起来不错

I dont really want to change the L&F engine, because apart from this it looks good.

推荐答案

在一般的,这是一个有点棘手。这取决于你使用的是精确的LAF。

In general this is a little bit tricky. It depends on exact LaF you are using.

例如。 JGoodies数据使用的重新定义这个东西自己的配色方案。

For example. JGoodies use own color scheme which redefine this stuff.

在一般属性名称是由像

COMPONENT_NAME_WITHOUT_J + '.' + PROPERTY. 

不幸的是,属性名只能从LAF的实现类得到的。这些都不是共享什么的。每个组件都有自己的。或者更好,这取决于他的作者使用的对懒惰。一般来说。

Unfortunately, property names can be only obtained from implementation classes of LaF. These aren't shared or something. Each component has its own. Or better, it depends on laziness of author which pairs he used. In general.

有一个很大的帮助,使重新定义面板。*和按钮的。很多组件的使用按钮。的属性。

A lot of help makes redefine Panel.* and Button.. A lot of components use Button. properties.

尝试,玩,赢:)。祝你好运 :)。

Try, play, win :). I wish you luck :).

PS:这是一个很大的属性来覆盖的。但是,这是怎么LAFS的工作方式。

PS: It is a lot of properties to overwrite. But this is the way how LaFs works.

这篇关于Java的改变挥杆的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆