<div> JavaScript is disabled on your browser.
Skip navigation links
Java™ Platform
Standard Ed. 8

Package javax.swing.plaf.nimbus

提供用户界面对象建立跨平台的灵气的外观和感觉。

See: 描述

Package javax.swing.plaf.nimbus Description

提供用户界面对象建立跨平台的灵气的外观和感觉。

灵气运用的Painter接口实例的涂料成分。每个Swing组件将前景和背景Painter,可能会有不同的组件状态的几位画家。

灵气让它的许多特性,包括画家的定制,通过改变UIDefaults表。下面是一个例子:

”。把(“进度条。tilewidth”,mytilewidth);”。把(“进度条[启用]。backgroundpainter”,mybgpainter);”。把(“进度条[启用]。foregroundpainter”,myfgpainter);

每个组件定制也是可能的。当渲染一个组成部分,检查其客户属性命名为“灵气灵气。重写”。此属性的值应该是UIDefaults实例。从那张桌子覆盖”设置,但对于特定的组件实例。一个可选的客户端属性,“灵气。重写。inheritdefaults”式的布尔值,指定是否重写默认的设置应与合并(true),或更换(false)。默认情况下,它们被合并:

jprogressbar吧=新jprogressbar();uidefaults重写=新uidefaults();重写。把(“ProgressBar。周期”,330);…酒吧。putclientproperty(“灵气。重写,重写);酒吧。putclientproperty(“灵气。重写。inheritdefaults”,假);

颜色中的灵气是来自一套核心的primary colors。也有secondary colors,这是来自基层的,但为自己的其他衍生颜色基色。派生机制允许运行时定制,即如果一个主或二次颜色被改变,来自它的所有颜色都会自动更新。方法NimbusLookAndFeel.getDerivedColor(java.lang.String, float, float, float, int, boolean)可以用来创建一个派生的颜色。

这些类被设计为在相应的LookAndFeel类已安装使用(UIManager.setLookAndFeel(new XXXLookAndFeel()))。使用它们而安装不同的LookAndFeel可能会产生意外的结果,包括例外。此外,改变LookAndFeelUIManager没有更新任何JComponents相应ComponentUI也可能产生意想不到的结果,如错误的颜色显示出来,一般是不鼓励。

注:大多数Swing API不是线程安全的。详情见Concurrency in Swing,java教程中的一部分。

从以下版本开始:
1.7
Skip navigation links
Java™ Platform
Standard Ed. 8

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.

本帮助文档是使用 《百度翻译》翻译,请与英文版配合使用 by--QQ:654638585