mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-07-06 00:32:44 +08:00
110 lines
6.6 KiB
HTML
110 lines
6.6 KiB
HTML
<div class="header">
|
||
<h1 class="title" title="Package">Package javax.swing.plaf.nimbus</h1>
|
||
<div class="docSummary">
|
||
<div class="block">
|
||
提供根据跨平台Nimbus外观构建的用户界面对象。
|
||
</div>
|
||
</div>
|
||
<p>See: <a href="#package.description">描述</a></p>
|
||
</div><div class="contentContainer">
|
||
<ul class="blockList">
|
||
<li class="blockList">
|
||
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Class Summary table, listing classes, and an explanation">
|
||
<caption>
|
||
<span>类摘要</span>
|
||
<span class="tabEnd"> </span>
|
||
</caption>
|
||
<tbody>
|
||
<tr>
|
||
<th class="colFirst" scope="col">类</th>
|
||
<th class="colLast" scope="col">描述</th>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../../javax/swing/plaf/nimbus/AbstractRegionPainter.html" title="class in javax.swing.plaf.nimbus">AbstractRegionPainter</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
方便的基类,用于定义Painter实例,用于渲染Nimbus中的区域或组件。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../../javax/swing/plaf/nimbus/AbstractRegionPainter.PaintContext.html" title="class in javax.swing.plaf.nimbus">AbstractRegionPainter.PaintContext</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
一个类封装状态在绘画时有用。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../../javax/swing/plaf/nimbus/NimbusLookAndFeel.html" title="class in javax.swing.plaf.nimbus">NimbusLookAndFeel</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
NimbusLookAndFeel类。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="rowColor">
|
||
<td class="colFirst"><a href="../../../../javax/swing/plaf/nimbus/NimbusStyle.html" title="class in javax.swing.plaf.nimbus">NimbusStyle</a></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
Nimbus使用的SynthStyle实现。
|
||
</div> </td>
|
||
</tr>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../../javax/swing/plaf/nimbus/State.html" title="class in javax.swing.plaf.nimbus">State</a><T extends <a href="../../../../javax/swing/JComponent.html" title="class in javax.swing">JComponent</a>></td>
|
||
<td class="colLast">
|
||
<div class="block">
|
||
代表Nimbus内置或定制的状态。
|
||
</div> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table> </li>
|
||
<li class="blockList">
|
||
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Enum Summary table, listing enums, and an explanation">
|
||
<caption>
|
||
<span>枚举摘要</span>
|
||
<span class="tabEnd"> </span>
|
||
</caption>
|
||
<tbody>
|
||
<tr>
|
||
<th class="colFirst" scope="col">Enum</th>
|
||
<th class="colLast" scope="col">描述</th>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr class="altColor">
|
||
<td class="colFirst"><a href="../../../../javax/swing/plaf/nimbus/AbstractRegionPainter.PaintContext.CacheMode.html" title="enum in javax.swing.plaf.nimbus">AbstractRegionPainter.PaintContext.CacheMode</a></td>
|
||
<td class="colLast"> </td>
|
||
</tr>
|
||
</tbody>
|
||
</table> </li>
|
||
</ul>
|
||
<a name="package.description">
|
||
<!-- --> </a>
|
||
<h2 title="Package javax.swing.plaf.nimbus Description">Package javax.swing.plaf.nimbus Description</h2>
|
||
<div class="block">
|
||
Provides user interface objects built according to the cross-platform Nimbus look and feel.
|
||
<p>Nimbus uses instances of the <a href="../../../../javax/swing/Painter.html" title="interface in javax.swing"><code>Painter</code></a> interface to paint components. With each Swing component it associates a foreground and a background <code>Painter</code>, and there may be several painters for different component states. </p>
|
||
<p>Nimbus allows customizing many of its properties, including painters, by altering the <a href="../../../../javax/swing/UIDefaults.html" title="class in javax.swing"><code>UIDefaults</code></a> table. Here's an example: </p>
|
||
<pre>UIManager.put("ProgressBar.tileWidth", myTileWidth);
|
||
UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
|
||
UIManager.put("ProgressBar[Enabled].foregroundPainter", myFgPainter);</pre>
|
||
<p>Per-component customization is also possible. When rendering a component, Nimbus checks its client property named "Nimbus.Overrides". The value of this property should be an instance of <code>UIDefaults</code>. Settings from that table override the UIManager settings, but for that particular component instance only. An optional client property, "Nimbus.Overrides.InheritDefaults" of type Boolean, specifies whether the overriding settings should be merged with default ones (<code>true</code>), or replace them (<code>false</code>). By default they are merged: </p>
|
||
<pre>JProgressBar bar = new JProgressBar();
|
||
UIDefaults overrides = new UIDefaults();
|
||
overrides.put("ProgressBar.cycleTime", 330);
|
||
...
|
||
bar.putClientProperty("Nimbus.Overrides", overrides);
|
||
bar.putClientProperty("Nimbus.Overrides.InheritDefaults", false);</pre>
|
||
<p>Colors in Nimbus are derived from a core set of <a href="doc-files/properties.html#primaryColors">primary colors</a>. There are also <a href="doc-files/properties.html#secondaryColors">secondary colors</a>, which are derived from primary ones, but serve themselves as base colors for other derived colors. The derivation mechanism allows for runtime customization, i.e. if a primary or secondary color is changed, all colors that are derived from it are automatically updated. The method <a href="../../../../javax/swing/plaf/nimbus/NimbusLookAndFeel.html#getDerivedColor-java.lang.String-float-float-float-int-boolean-"><code>NimbusLookAndFeel.getDerivedColor(java.lang.String, float, float, float, int, boolean)</code></a> may be used to create a derived color. </p>
|
||
<p>These classes are designed to be used while the corresponding <code>LookAndFeel</code> class has been installed (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>). Using them while a different <code>LookAndFeel</code> is installed may produce unexpected results, including exceptions. Additionally, changing the <code>LookAndFeel</code> maintained by the <code>UIManager</code> without updating the corresponding <code>ComponentUI</code> of any <code>JComponent</code>s may also produce unexpected results, such as the wrong colors showing up, and is generally not encouraged. </p>
|
||
<p><strong>Note:</strong> Most of the Swing API is <em>not</em> thread safe. For details, see <a href="http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html" target="_top">Concurrency in Swing</a>, a section in <em><a href="http://java.sun.com/docs/books/tutorial/" target="_top">The Java Tutorial</a></em>.</p>
|
||
</div>
|
||
<dl>
|
||
<dt>
|
||
<span class="simpleTagLabel">从以下版本开始:</span>
|
||
</dt>
|
||
<dd>
|
||
1.7
|
||
</dd>
|
||
</dl>
|
||
</div> |