Ejemplo n.º 1
0
 /**
  * Registers a third party component with the NimbusLookAndFeel.
  *
  * <p>Regions represent Components and areas within Components that act as independent painting
  * areas. Once registered with the NimbusLookAndFeel, NimbusStyles for these Regions can be
  * retrieved via the <code>getStyle</code> method.
  *
  * <p>The NimbusLookAndFeel uses a standard naming scheme for entries in the UIDefaults table. The
  * key for each property, state, painter, and other default registered in UIDefaults for a
  * specific Region will begin with the specified <code>prefix</code>
  *
  * <p>For example, suppose I had a component named JFoo. Suppose I then registered this component
  * with the NimbusLookAndFeel in this manner:
  *
  * <pre><code>
  *     laf.register(NimbusFooUI.FOO_REGION, "Foo");
  * </code></pre>
  *
  * <p>In this case, I could then register properties for this component with UIDefaults in the
  * following manner:
  *
  * <pre><code>
  *     UIManager.put("Foo.background", new ColorUIResource(Color.BLACK));
  *     UIManager.put("Foo.Enabled.backgroundPainter", new FooBackgroundPainter());
  * </code></pre>
  *
  * <p>It is also possible to register a named component with Nimbus. For example, suppose you
  * wanted to style the background of a JPanel named "MyPanel" differently from other JPanels. You
  * could accomplish this by doing the following:
  *
  * <pre><code>
  *     laf.register(Region.PANEL, "\"MyPanel\"");
  *     UIManager.put("\"MyPanel\".background", new ColorUIResource(Color.RED));
  * </code></pre>
  *
  * @param region The Synth Region that is being registered. Such as Button, or ScrollBarThumb, or
  *     NimbusFooUI.FOO_REGION.
  * @param prefix The UIDefault prefix. For example, could be ComboBox, or if a named components,
  *     "MyComboBox", or even something like ToolBar."MyComboBox"."ComboBox.arrowButton"
  */
 public void register(Region region, String prefix) {
   defaults.register(region, prefix);
 }