< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/nimbus/package-info.java

Print this page


   1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
   2 <html>
   3 <head>
   4 <!--
   5 Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
   6 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7 
   8 This code is free software; you can redistribute it and/or modify it
   9 under the terms of the GNU General Public License version 2 only, as
  10 published by the Free Software Foundation.  Oracle designates this
  11 particular file as subject to the "Classpath" exception as provided
  12 by Oracle in the LICENSE file that accompanied this code.
  13 
  14 This code is distributed in the hope that it will be useful, but WITHOUT
  15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17 version 2 for more details (a copy is included in the LICENSE file that
  18 accompanied this code).
  19 
  20 You should have received a copy of the GNU General Public License version
  21 2 along with this work; if not, write to the Free Software Foundation,
  22 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  23 
  24 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  25 or visit www.oracle.com if you need additional information or have any
  26 questions.
  27 -->
  28 <title></title>
  29 </head>
  30 <body bgcolor="white">
  31 
  32 Provides user interface objects built according to the cross-platform
  33 Nimbus look and feel.
  34 
  35 <p>Nimbus uses instances of the {@link javax.swing.Painter} interface to paint
  36 components. With each Swing component it associates a foreground and a
  37 background {@code Painter}, and there may be several painters for different
  38 component states.
  39 
  40 <p>Nimbus allows customizing many of its properties, including painters, by
  41 altering the {@link javax.swing.UIDefaults} table. Here's an example:
  42 <pre>
  43     UIManager.put("ProgressBar.tileWidth", myTileWidth);
  44     UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
  45     UIManager.put("ProgressBar[Enabled].foregroundPainter", myFgPainter);
  46 </pre>
  47 
  48 <p>Per-component customization is also possible. When rendering a component,
  49 Nimbus checks its client property named "Nimbus.Overrides". The value of this
  50 property should be an instance of {@code UIDefaults}. Settings from that table
  51 override the UIManager settings, but for that particular component instance
  52 only. An optional client property, "Nimbus.Overrides.InheritDefaults" of type
  53 Boolean, specifies whether the overriding settings should be merged with
  54 default ones ({@code true}), or replace them ({@code false}). By default they
  55 are merged:
  56 <pre>
  57     JProgressBar bar = new JProgressBar();
  58     UIDefaults overrides = new UIDefaults();
  59     overrides.put("ProgressBar.cycleTime", 330);
  60     ...
  61     bar.putClientProperty("Nimbus.Overrides", overrides);
  62     bar.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
  63 </pre>
  64 
  65 <p>Colors in Nimbus are derived from a core set of
  66 <a href="doc-files/properties.html#primaryColors">primary colors</a>. There are also
  67 <a href="doc-files/properties.html#secondaryColors">secondary colors</a>, which are
  68 derived from primary ones, but serve themselves as base colors for other
  69 derived colors. The derivation mechanism allows for runtime customization,
  70 i.e. if a primary or secondary color is changed, all colors that are derived
  71 from it are automatically updated. The method
  72 {@link javax.swing.plaf.nimbus.NimbusLookAndFeel#getDerivedColor(java.lang.String, float, float, float, int, boolean)}
  73 may be used to create a derived color.
  74 
  75 <p>These classes are designed to be used while the
  76 corresponding <code>LookAndFeel</code> class has been
  77 installed
  78 (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>).
  79 Using them while a different <code>LookAndFeel</code> is installed
  80 may produce unexpected results, including exceptions.
  81 Additionally, changing the <code>LookAndFeel</code>
  82 maintained by the <code>UIManager</code> without updating the
  83 corresponding <code>ComponentUI</code> of any
  84 <code>JComponent</code>s may also produce unexpected results,
  85 such as the wrong colors showing up, and is generally not
  86 encouraged.
  87 
  88 <p><strong>Note:</strong>
  89 Most of the Swing API is <em>not</em> thread safe.
  90 For details, see
  91 <a href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
  92    target="_top">Concurrency in Swing</a>,
  93 a section in
  94 <em><a href="http://docs.oracle.com/javase/tutorial/"
  95        target="_top">The Java Tutorial</a></em>.
  96 
  97 @since 1.7
  98 @serial exclude
  99 
 100 </body>
 101 </html>
   1 /*
   2  * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /**
  27  * Provides user interface objects built according to the cross-platform Nimbus
  28  * look and feel.
  29  * <p>
  30  * Nimbus uses instances of the {@link javax.swing.Painter} interface to paint
  31  * components. With each Swing component it associates a foreground and a
  32  * background {@code Painter}, and there may be several painters for different
  33  * component states.
  34  * <p>
  35  * Nimbus allows customizing many of its properties, including painters, by
  36  * altering the {@link javax.swing.UIDefaults} table. Here's an example:
  37  * <pre>
  38  * UIManager.put("ProgressBar.tileWidth", myTileWidth);
  39  * UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
  40  * UIManager.put("ProgressBar[Enabled].foregroundPainter", myFgPainter);
  41  * </pre>
  42  * <p>
  43  * Per-component customization is also possible. When rendering a component,
  44  * Nimbus checks its client property named "Nimbus.Overrides". The value of this
  45  * property should be an instance of {@code UIDefaults}. Settings from that
  46  * table override the UIManager settings, but for that particular component
  47  * instance only. An optional client property,
  48  * "Nimbus.Overrides.InheritDefaults" of type Boolean, specifies whether the
  49  * overriding settings should be merged with default ones ({@code true}), or
  50  * replace them ({@code false}). By default they are merged:
  51  * <pre>
  52  * JProgressBar bar = new JProgressBar();
  53  * UIDefaults overrides = new UIDefaults();
  54  * overrides.put("ProgressBar.cycleTime", 330);
  55  * ...
  56  * bar.putClientProperty("Nimbus.Overrides", overrides);
  57  * bar.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
  58  * </pre>
  59  * <p>
  60  * Colors in Nimbus are derived from a core set of
  61  * <a href="doc-files/properties.html#primaryColors">primary colors</a>. There
  62  * are also
  63  * <a href="doc-files/properties.html#secondaryColors">secondary colors</a>,
  64  * which are derived from primary ones, but serve themselves as base colors for
  65  * other derived colors. The derivation mechanism allows for runtime
  66  * customization, i.e. if a primary or secondary color is changed, all colors
  67  * that are derived from it are automatically updated. The method
  68  * {@link javax.swing.plaf.nimbus.NimbusLookAndFeel#getDerivedColor(java.lang.String, float, float, float, int, boolean)}
  69  * may be used to create a derived color.
  70  * <p>
  71  * These classes are designed to be used while the corresponding
  72  * {@code LookAndFeel} class has been installed
  73  * (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>).
  74  * Using them while a different {@code LookAndFeel} is installed may produce
  75  * unexpected results, including exceptions. Additionally, changing the
  76  * {@code LookAndFeel} maintained by the {@code UIManager} without updating the
  77  * corresponding {@code ComponentUI} of any {@code JComponent}s may also produce
  78  * unexpected results, such as the wrong colors showing up, and is generally not
  79  * encouraged.
  80  * <p>
  81  * <strong>Note:</strong>
  82  * Most of the Swing API is <em>not</em> thread safe. For details, see
  83  * <a
  84  * href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
  85  * target="_top">Concurrency in Swing</a>,
  86  * a section in
  87  * <em><a href="http://docs.oracle.com/javase/tutorial/"
  88  * target="_top">The Java Tutorial</a></em>.
  89  *
  90  * @since 1.7
  91  * @serial exclude
  92  */
  93 package javax.swing.plaf.nimbus;








< prev index next >