jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html
author yan
Mon, 14 Oct 2013 11:47:27 +0400 (2013-10-14)
changeset 21254 f6d36ee3f269
parent 7959 2e05332a8f5c
child 23715 54ae9dd9df73
permissions -rw-r--r--
8025824: [cleanup] Fix tidy errors and warnings in preformatted HTML files related to 2d/awt/swing Reviewed-by: anthony, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
<html>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
  <head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
    <title>Synth File Format</title>
21254
f6d36ee3f269 8025824: [cleanup] Fix tidy errors and warnings in preformatted HTML files related to 2d/awt/swing
yan
parents: 7959
diff changeset
     5
  <style type="text/css">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
div.dtd-fragment {
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
    width: 100%;
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
    border: none;
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
    background-color: #eee;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
pre.dtd-fragment {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
    margin-left: 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
div.example {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
    width: 100%;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
    color: maroon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
  </style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
  </head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
  <body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
    <h2><a name="file">File Format</a></h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
      Synth's file format (<a href="synth.dtd">dtd</a>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
      allows for specifying all the pieces
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
      necessary to create your own look and feel. A synth file is
21254
f6d36ee3f269 8025824: [cleanup] Fix tidy errors and warnings in preformatted HTML files related to 2d/awt/swing
yan
parents: 7959
diff changeset
    27
      loaded by way of the <A HREF="../../../../../javax/swing/plaf/synth/SynthLookAndFeel.html#load(java.io.InputStream,%20java.lang.Class)">SynthLookAndFeel.load(InputStream, Class)</a> or
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
      <a href="../../../../../javax/swing/plaf/synth/SynthLookAndFeel.html#load(java.net.URL)">SynthLookAndFeel.load(URL)</a> methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
      The following example uses the <code>load</code> method to configure 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
      a <code>SynthLookAndFeel</code> and sets it as the current look
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
      and feel:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  SynthLookAndFeel laf = new SynthLookAndFeel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  laf.load(MyClass.class.getResourceAsStream("laf.xml"), MyClass.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  UIManager.setLookAndFeel(laf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
      </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    </div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
      This example loads the look and feel from an input stream, using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
      the specified class as the resource base to resolve paths.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
      It is also possible to load a look and feel from an arbitrary URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
      as in the following example.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  SynthLookAndFeel laf = new SynthLookAndFeel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
  laf.load(new URL("file:///C:/java/synth/laf/laf.xml"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  UIManager.setLookAndFeel(laf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
      </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    </div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
      The method <a href="../../../../../javax/swing/plaf/synth/SynthLookAndFeel.html#load(java.net.URL)">SynthLookAndFeel.load(URL)</a> can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
      used, for instance, to load a look and feel from any of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
      <li>File, e.g. <code>file:///C:/java/synth/laf/laf.xml</code></li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
      <li>Web server, e.g. <code>http://host/laf.xml</code></li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
      <li>JAR file, e.g.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        <code>jar:file:///C:/synth-laf.jar!/laf.xml</code></li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
      <li>Remote JAR file, e.g.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        <code>jar:http://host/synth-laf.jar!/laf.xml</code></li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
      While the DTD for synth is specified, the parser is not validating.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
      Parsing will fail only if a necessary attribute is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
      specified, or of the wrong type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    <h3>The synth element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
&lt;!ELEMENT <a name="e.synth">synth</a> ((<a href="#ee.beansPersistance">%beansPersistance;</a>) | <a href="#e.style">style</a> | <a href="#e.bind">bind</a> | <a href="#e.font">font</a> | <a href="#e.color">color</a> |
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                 <a href="#e.imagePainter">imagePainter</a> | <a href="#e.imageIcon">imageIcon</a> | <a href="#e.defaultsProperty">defaultsProperty</a>)*>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
&lt;!ATTLIST synth
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
          <a href="#synth.version">version</a>              CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    <dl><dt><a name="synth.version"><samp>version</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
	<dd>File format version, should be 1</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
      The <a href="#e.synth">synth</a> element contains all the other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
      elements that make up a SynthLookAndFeel definition.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
      
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    <h3>The style element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
&lt;!ELEMENT <a name="e.style">style</a> (<a href="#e.property">property</a> | <a href="#e.defaultsProperty">defaultsProperty</a> | <a href="#e.state">state</a> | <a href="#e.font">font</a> | <a href="#e.graphicsUtils">graphicsUtils</a> |
7959
2e05332a8f5c 6589952: Swing: dead links in API documentation
rupashka
parents: 2
diff changeset
    94
                 <a href="#e.insets">insets</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | <a href="#e.opaque">opaque</a> | (<a href="#ee.beansPersistance">%beansPersistance;</a>) |
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                 <a href="#e.imageIcon">imageIcon</a>)*>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
&lt;!ATTLIST style
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
          <a href="#style.id">id</a>              ID          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
          <a href="#style.clone">clone</a>           IDREF       #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
      <dt><a name="style.id"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      <dd>Unique identifier for the style.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      <dt><a name="style.clone"><samp>clone</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
      <dd>Identifier of a previously defined style that is copied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
	    and used for the new style. This provides a conveniant
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
	    mechanism for overriding only a portion of an existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
	    style.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    <p>
21254
f6d36ee3f269 8025824: [cleanup] Fix tidy errors and warnings in preformatted HTML files related to 2d/awt/swing
yan
parents: 7959
diff changeset
   113
      A style element corresponds to a
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
      <code>SynthStyle</code>, with the child elements specifying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
      properties that apply to all states or state elements which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      contain properties specific to a particular state. The following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      example creates an opaque style with the id <code>button</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
      insets of 4, 4, 4, 4 and a font of Dialog 12.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
&lt;style id="button">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
  &lt;opaque value="true"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
  &lt;insets top="4" left="4" right="4" bottom="4"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
  &lt;font name="Dialog" size="12"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
      </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    </div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
      The following example creates a new style with an id of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
      <code>clonedButton</code> that is a copy of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
      style with id <code>button</code> and has a font of Dialog,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
      14. The resulting style will be opaque, have insets of 4, 4, 4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
      4 and a font of Dialog 14.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
&lt;style id="clonedButton" clone="button">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  &lt;font name="Dialog" size="14"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
      </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    </div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    <h3>The state element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
&lt;!ELEMENT <a name="e.state">state</a> (<a href="#e.color">color</a> | <a href="#e.font">font</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | (<a href="#ee.beansPersistance">%beansPersistance;</a>) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                 <a href="#e.property">property</a> |  <a href="#e.imageIcon">imageIcon</a>)*>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
&lt;!ATTLIST state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
          <a href="#state.id">id</a>              ID             #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
          <a href="#state.clone">clone</a>           IDREF          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
          <a href="#state.value">value</a>           CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
          <a href="#state.idref">idref</a>           IDREF          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
      <dt><a name="state.id"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
      <dd>Unique identifier for the state.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
      <dt><a name="state.clone"><samp>clone</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
      <dd>Identifier of a previously defined state that is copied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
	and used for the new state.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
      <dt><a name="state.value"><samp>value</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
      <dd>Identifies the state of the Component the properties are to apply
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
	to. This is a list of: ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
	MOUSE_OVER, PRESSED, DISABLED, FOCUSED, SELECTED or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
	DEFAULT. Multiple states should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
	be separated by 'and.' If you do not specify a value, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
	contents apply to all states.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      <dt><a name="state.idref"><samp>idref</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
      <dd>Indicates this state should be the same as a previously
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
	    defined state. This is useful for multiple styles that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
	    wish to share the same visual properties for a particular
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
	    state.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
      </dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
      The <a href="#e.state">state</a> element specifies the visual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      properties that are to be used for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      a particular state of a component. For example, you could
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
      specify the background color when the Component is enabled should look
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      different than the background color when the component is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      disabled. Not all Components support all states. For example, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
      <code>Panel</code> only supports the states ENABLED and DISABLED.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
      The following example creates a state with a red background that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
      will be used when the component is in an a selected and pressed state:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
&lt;state value="SELECTED AND PRESSED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
  &lt;color value="RED" type="BACKGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
&lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      The state with the most individual matches will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      chosen. For example, the following defines two states:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
&lt;state value="SELECTED and PRESSED" id="one">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
  &lt;color value="RED" type="BACKGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
&lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
&lt;state value="SELECTED" id="two">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
  &lt;color value="RED" type="BACKGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
&lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
      State <code>one</code> is used when the Component is SELECTED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
      and PRESSED, and state <code>two</code> when the Component is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
      SELECTED. If the state of the Component 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
      contains at least SELECTED and PRESSED, state <code>one</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
      chosen, otherwise if the state is SELECTED, but not does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
      contain PRESSED, state <code>two</code> will be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    <h3>The font element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
&lt;!ELEMENT <a name="e.font">font</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
&lt;!ATTLIST font
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
          <a href="#font.id">id</a>              ID             #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
          <a href="#font.idref">clone</a>           IDREF          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
          <a href="#font.name">name</a>            CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
          <a href="#font.style">style</a>           CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
          <a href="#font.size">size</a>            CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
      <dt><a name="font.id"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
      <dd>Unique identifier for the Font.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
      <dt><a name="font.idref"><samp>idref</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
      <dd>Identifier of a previously defined font.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
      <dt><a name="font.name"><samp>name</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
      <dd>Name of the font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      <dt><a name="font.style"><samp>style</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
      <dd>Style of the font. This is a list of the styles defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
	Font separated by spaces: PLAIN, BOLD or ITALIC. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
	unspecified PLAIN is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
      </dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
      <dt><a name="font.size"><samp>size</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
      <dd>Size of the font, in pixels</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      Defines the font for the current <a href="#e.state">state</a>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      or <a href="#e.style">style</a>. You must
7959
2e05332a8f5c 6589952: Swing: dead links in API documentation
rupashka
parents: 2
diff changeset
   252
      specify either an <a href="#font.idref">idref</a> or a
2e05332a8f5c 6589952: Swing: dead links in API documentation
rupashka
parents: 2
diff changeset
   253
      <a href="#font.name">name</a> and <a href="#font.size">size</a>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
      The following example creates a style with a Font of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
      Dialog 12 Bold.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
  &lt;font name="DIALOG" size="12" style="BOLD"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
      The following example creates a style with a font of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
      Dialog 12 Bold that will be used if the component is ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
      otherwise Dialog 12 Italic will be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
  &lt;font name="DIALOG" size="12" style="ITALIC"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
  &lt;state value="ENABLED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    &lt;font name="DIALOG" size="12" style="BOLD"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
  &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
      While you can supply a different font per state, in general
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
      widgets will NOT revalidate when the state changes, so that you
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
      may run into sizing problems if you try to use a font with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
      significantly different size for different states.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    <h3>The color element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
&lt;!ELEMENT <a name="e.color">color</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
&lt;!ATTLIST color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
          <a href="#color.id">id</a>              ID             #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
          <a href="#color.idref">idref</a>           IDREF          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
          <a href="#color.type">type</a>            CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
          <a href="#color.value">value</a>           CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      <dt><a name="color.id"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      <dd>Unique identifier for the color.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      <dt><a name="color.idref"><samp>idref</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      <dd>Identifier of a previously defined color.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      <dt><a name="color.type"><samp>type</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      <dd>Describes where this color should be used. This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
	    typically one of the constants defined by ColorType:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
	    FOREGROUND, BACKGROUND, TEXT_FOREGROUND, TEXT_BACKGROUND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
	    or FOCUS. Alternatively you can specify the complete path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
	    to a class and field, for example
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
	    javax.swing.plaf.synth.ColorType.FOREGROUND, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
	    is useful for subclasses of synth that define additional
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
	    color types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
      </dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
      <dt><a name="color.value"><samp>value</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
      <dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        Value for the color. This accepts the following forms. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
          <li>The name of a constant in the <code>Color</code> class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            for example <code> RED</code>. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
          <li>A hex value of the form <code>#RRGGBB</code> where
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            <code>RR</code> gives the red component, <code>GG</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            the green component and <code>BB</code> the blue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            component. You need not specify all color components. For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            example, <code>#123</code> is equivalent to <code>#000123</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
          <li>A hex value of the form <code>#ARRGGBB</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            <code>#AARRGGBB</code>. This is useful for alpha values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
            other than <code>0xFF</code>. The form
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            <code>#ARRGGBB</code> is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            <code>#0ARRGGBB</code>. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
      </dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
      <a href="#e.color">Color</a> defines a color and what portion of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
      the Component it should be applied to. The following example
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
      will use a background color of RED when the component is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
      enabled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
&lt;state value="ENABLED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
  &lt;color value="RED" type="BACKGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
&lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
      The following example will have a red background when the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
      Component is enabled, otherwise blue.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
  &lt;state value="ENABLED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    &lt;color value="RED" type="BACKGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
  &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
  &lt;state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    &lt;color value="#00FF00" type="BACKGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
  &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    <h3>The property element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
&lt;!ELEMENT <a name="e.property">property</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
&lt;!ATTLIST property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
          <a href="#property.key">key</a>               CDATA                                             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
          <a href="#property.type">type</a>              (idref|boolean|dimension|insets|integer|string)          "idref"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
          <a href="#property.value">value</a>             CDATA                                             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
      <dt><a name="property.key"><samp>key</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
      <dd>Name of the property.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
      <dt><a name="property.type"><samp>type</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
      <dd>Indicates the type of the property.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
      <dt><a name="property.value"><samp>value</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
      <dd>Value for the property. For boolean properties this will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
	be true or false, for integer properties this will be a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
	valid integer, for dimensions this will be the width and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
	height separated by a space, for insets properties this will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
	be the top, left, bottom and right separated by a space and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
	for idref properties this will be the unique id of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
	previously defined object.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
      <a href="#e.property">Property</a> elements are used to add key value pairs to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
      <code>SynthStyle</code> that can be accessed by way of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
      <code>get</code> method. Many <code>Component</code>s use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
      key value pairs for configuring their visual appearance. Refer to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
      <a href="componentProperties.html">property table</a> for a list of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
      properties each <code>Component</code> supports. The following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
      creates the properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
      <code>ScrollBar.allowsAbsolutePositioning</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
      <code>OptionPane.minimumSize</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
      <code>ScrollPane.viewportBorderInsets</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
      <code>Tree.rowHeight</code> and <code>foreground</code> with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
      values false, a dimensions of 262x90, an insets of 5, 5, 5, 5,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
      the integer 20 and an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
      class ArrowButtonPainter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
  &lt;property key="ScrollBar.allowsAbsolutePositioning" type="boolean" value="false"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
  &lt;property key="OptionPane.minimumSize" type="dimension" value="262 90"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
  &lt;property key="ScrollPane.viewportBorderInsets" type="insets" value="5 5 5 5"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
  &lt;property key="Tree.rowHeight" type="integer" value="20"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
  &lt;object class="ArrowButtonPainter" id="ArrowButtonPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
  &lt;property key="foreground" type="idref" value="ArrowButtonPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      You can also specify properties that are to apply to specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
      states.  Whether or not the property is accessed for each state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
      depends upon how the property is used.  For example, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
      following specifies a default icon and an icon to use while the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
      mouse is over the component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
  &lt;imageIcon id="defaultIcon" path="resources/myImage.png"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
  &lt;property key="RadioButton.icon" value="defaultIcon"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
  &lt;state value="MOUSE_OVER">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    &lt;imageIcon id="mouseOverIcon" path="resources/myMouseOverImage.png"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    &lt;property key="RadioButton.icon" value="mouseOverIcon"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
  &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
&lt;!ELEMENT <a name="e.defaultsProperty">defaultsProperty</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
&lt;!ATTLIST defaultsProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
          <a href="#defaultsProperty.key">key</a>               CDATA                                             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
          <a href="#defaultsProperty.type">type</a>              (idref|boolean|dimension|insets|integer|string)   "idref"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
          <a href="#defaultsProperty.value">value</a>             CDATA                                             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
      <dt><a name="defaultsProperty.key"><samp>key</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
      <dd>Name of the property.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
      <dt><a name="defaultsProperty.type"><samp>type</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
      <dd>Indicates the type of the property.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
      <dt><a name="defaultsProperty.value"><samp>value</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
      <dd>Value for the property. For boolean properties this will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
	true or false, for integer properties this will be a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
	valid integer, for dimensions this will be the width and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
	height separated by a space, for insets properties this will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
	be the top, left, bottom and right separated by a space and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
	for idref properties this will be the unique id of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
	previously defined object.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
      <a href="#e.defaultsProperty">DefaultsProperty</a> elements are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
      used to define properties that will be placed in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
      <code>UIDefaults</code> table that <code>SynthLookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
      supplies to the <code>UIManager</code>. The following assigns the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
      the Color red to the value Table.focusCellForeground.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
  &lt;object class="javax.swing.plaf.ColorUIResource" id="color">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    &lt;int>255&lt;/int>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    &lt;int>0&lt;/int>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    &lt;int>0&lt;/int>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
  &lt;/object>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
  &lt;defaultsProperty key="Table.focusCellForeground" type="idref" value="color"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
      This value could then be asked by way of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
      <code>UIManager.get("Table.focusCellForeground")</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    <h3>The graphicsUtils element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
&lt;!ELEMENT <a name="e.graphicsUtils">graphicsUtils</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
&lt;!ATTLIST graphicsUtils
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
          <a href="#graphicsUtils.idref">idref</a>           IDREF             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
      <dt><a name="graphicsUtils.idref"><samp>idref</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
      <dd>Identifer of a previously defined SynthGraphicsUtils object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
	that is to be used as the SynthGraphicsUtils for the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
	<a href="#e.style">style</a>.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      <a href="#e.graphicsUtils">GraphicsUtils</a> elements are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
      used to define the SynthGraphicsUtils that the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
      <a href="#e.style">style</a> will use. The following example
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
      creates a style with an instance of CustomGraphicsUtils for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
      SynthGraphicsUtils.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
  &lt;object class="CustomGraphicsUtils" id="graphics"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
  &lt;graphicsUtils idref="graphics"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    <h3>The insets element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
&lt;!ELEMENT <a name="e.insets">insets</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
&lt;!ATTLIST insets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
          <a href="#insets.id">id</a>           ID             #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
          <a href="#insets.idref">idref</a>        IDREF          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
          <a href="#insets.top">top</a>          CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
          <a href="#insets.bottom">bottom</a>       CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
          <a href="#insets.left">left</a>         CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
          <a href="#insets.right">right</a>        CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
      <dt><a name="insets.id"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
      <dd>Unique identifier for the Insets.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
      <dt><a name="insets.idref"><samp>idref</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
      <dd>Identifier of a previously defined Insets.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
      <dt><a name="insets.top"><samp>top</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
      <dd>Top component of the Insets.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
      <dt><a name="insets.bottom"><samp>bottom</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
      <dd>Bottom component of the Insets.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
      <dt><a name="insets.left"><samp>left</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
      <dd>Left component of the Insets.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
      <dt><a name="insets.right"><samp>right</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
      <dd>Right component of the Insets.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
      <a href="#e.insets">Insets</a> elements are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
      used to define the Insets for the current <a href="#e.style">style</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
      The insets will be set on any Components the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
      <a href="#e.style">style</a> is associated with. The following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
      example creates a style with insets of 1, 2, 3, 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
  &lt;insets top="1" bottom="2" left="3"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
    <h3>The bind element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
&lt;!ELEMENT <a name="e.bind">bind</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
&lt;!ATTLIST bind
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
          <a href="#bind.style">style</a>        IDREF             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
          <a href="#bind.type">type</a>         (name|region)     #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
          <a href="#bind.key">key</a>          CDATA             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
      <dt><a name="bind.style"><samp>style</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
      <dd>Unique identifier of a previously defined style.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
      <dt><a name="bind.type"><samp>type</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
      <dd>One of name or region. For type name component.getName() is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
	otherwise the name of the Region is used.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
      <dt><a name="bind.key"><samp>key</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
      <dd>Regular expression applied to the name of the Component, or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
	name of the Region, depending upon the value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
	<a href="#bind.type">type</a>.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
      <a href="#e.bind">Bind</a> elements specify which Regions a style
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
      is to be used for. The following example applies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
      <a href="#e.style">style</a> test to any Component whose name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
      starts with <code>test</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
  &lt;insets top="1" bottom="2" left="3"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
&lt;bind style="test" type="name" key="test.*"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
      Numerous styles may apply to a region, in which case each of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
      the matching styles is merged into a resulting style that is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
      Precedence is given to styles defined later in the file. For example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
      the following defines two styles, a and b. Style a is applied to any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
      component with a name starting with test, and style b is used for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
      button regions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
&lt;style id="a">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
  &lt;font name="DIALOG" size="12" style="ITALIC"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
  &lt;insets top="1" bottom="2" left="3"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
&lt;bind style="a" type="name" key="test.*"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
&lt;style id="b">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
  &lt;font name="DIALOG" size="12" style="BOLD"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
&lt;bind style="b" type="region" key="button"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
      For a button with the name test this is equivalent to:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
&lt;style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
  &lt;font name="DIALOG" size="12" style="BOLD"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
  &lt;insets top="1" bottom="2" left="3"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
      Merging happens for states of a style as well.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
&lt;style id="a">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
  &lt;font name="DIALOG" size="12" style="ITALIC"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
  &lt;insets top="1" bottom="2" left="3"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
  &lt;state value="ENABLED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
    &lt;object id="customPainter" class="CustomPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    &lt;painter idref="customPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
  &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
&lt;bind style="a" type="name" key="test.*"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
&lt;style id="b">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
  &lt;font name="DIALOG" size="12" style="BOLD"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
  &lt;state value="ENABLED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
    &lt;font name="Lucida" size="12" style="ITALIC"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
  &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
&lt;bind style="b" type="region" key="button"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
      For a button with the name test this is equivalent to:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
&lt;style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
  &lt;font name="DIALOG" size="12" style="BOLD"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
  &lt;insets top="1" bottom="2" left="3"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
  &lt;state value="ENABLED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
    &lt;object id="customPainter" class="CustomPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    &lt;painter idref="customPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
    &lt;font name="Lucida" size="12" style="ITALIC"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
  &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    <h3>The painter element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
&lt;!ELEMENT <a name="e.painter">painter</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
&lt;!ATTLIST painter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
          <a href="#painter.idref">idref</a>                 IDREF          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
          <a href="#painter.method">method</a>                CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
          <a href="#painter.direction">direction</a>             (north|south|east|west|top|left|bottom|right|horizontal|vertical|horizontal_split|vertical_split)          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
      <dt><a name="painter.idref"><samp>idref</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
      <dd>Identifier of a previously defined SynthPainter.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
      <dt><a name="painter.method"><samp>method</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
      <dd>Identifies the SynthPainter method this is to be used for. The name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
	corresponds to the method name of a paint method in SynthPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
	with the paint prefix dropped, the remainder is case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
	insensitive (using the latin1 case folding rules).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
	For example SynthPainter.paintButtonBackground is identified by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
	'buttonBackground' or 'buttonbackground'. If this is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
	not specified the painter is used for all methods that don't have a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
	a specific painter for them.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
      <dt><a name="painter.direction"><samp>direction</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
      <dd>Identifies the direction, or orientation, this painter is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
	used for. This is only useful for the SynthPainter methods that take
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
	a direction or orientation. If this is not specified the painter is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
	used for all directions.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
      <a href="#e.painter">Painter</a> defines a SynthPainter for the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
      style or the state of the current style. The following example
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
      binds an instance of the class <code>MyPainter</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
      which must be a <code>SynthPainter</code> to the style <code>test</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
  &lt;object class="MyPainter" id="MyPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
  &lt;painter idref="MyPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
      The painter that is used for a particular method and state is determined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
      as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
    <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
      <li>Painter specified for the current state, method and direction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
      <li>Painter specified for the current state and method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
      <li>Painter specified for the current state.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
      <li>Painter specified for the style, method and direction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
      <li>Painter specified for the style and method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
      <li>Painter specified for the style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
    </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
      Consider the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
  &lt;painter idref="fallbackPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
  &lt;painter idref="styleButtonBackgroundPainter" method="buttonBackground"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
  &lt;state value="SELECTED">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
    &lt;painter idref="stateFallbackPainter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
    &lt;painter idref="stateButtonBackgroundPainter" method="buttonBackground"/>
21254
f6d36ee3f269 8025824: [cleanup] Fix tidy errors and warnings in preformatted HTML files related to 2d/awt/swing
yan
parents: 7959
diff changeset
   739
  &lt;/state>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
      </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
    </div>      
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
      The following outlines which painter will be used for what
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
      SynthPainter method: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
    <table border=1>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
      <tr><th>State<th>Method<th>Painter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
	<tr><td>SELECTED<td>paintButtonBackground<td>stateButtonBackgroundPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
	<tr><td>SELECTED<td>Anything but paintButtonBackground<td>stateFallbackPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
	<tr><td>Anything but SELECTED<td>paintButtonBackground<td>styleButtonBackgroundPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
	<tr><td>Anything but SELECTED<td>Anything but paintButtonBackground<td>fallbackPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
    </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
      When several identical painters are declared, they are aggregated into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
      a single one. Two painters are identical if their <em>direction</em> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
      <em>method</em> attributes values are equal. Consider the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
	<div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
	  <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
&lt;style id="panelStyle"&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
  &lt;imagePainter method="panelBackground" path="red.png" /&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
  &lt;imagePainter method="panelBackground" path="green.png" /&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
  &lt;imagePainter method="panelBackground" path="blue.png" /&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
&lt;/style&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
	  </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
	</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
	<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
	  These three painters are identical for they use the same method and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
	  same direction (all directions by default). Synth aggregates these painters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
	  to create a single one that will paint its children painters in the order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
	  of declaration. Hence, Synth will first paint the red picture, then the green
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
	  one and finally the blue one. Each child painter can be seen as a layer of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
	  the aggregate painter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
	</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
	<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
	  Painter aggregation, or multi-layering, is very useful to reuse elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
	  Imagine you want to use an highlight effect on buttons and on selected
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
	  menu items. With painter aggregation, you just need to create a separate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
	  highlighting painter instead of having buttons and menu items painters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
	  handle it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
	</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
    <h3>The imagePainter element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
&lt;!ELEMENT <a name="e.imagePainter">imagePainter</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
&lt;!ATTLIST imagePainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
          <a href="#imagePainter.id">id</a>                    ID             #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
          <a href="#imagePainter.method">method</a>                CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
          <a href="#imagePainter.direction">direction</a>             (north|south|east|west|top|left|bottom|right|horizontal|vertical|horizontal_split|vertical_split)          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
          <a href="#imagePainter.path">path</a>                  CDATA          #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
          <a href="#imagePainter.sourceInsets">sourceInsets</a>          CDATA          #IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
          <a href="#imagePainter.destinationInsets">destinationInsets</a>     CDATA          #IMPLIED
7959
2e05332a8f5c 6589952: Swing: dead links in API documentation
rupashka
parents: 2
diff changeset
   798
          <a href="#imagePainter.painterCenter">paintCenter</a>           (true|false)   "true"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
          <a href="#imagePainter.stretch">stretch</a>               (true|false)   "true"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
          <a href="#imagePainter.center">center</a>                (true|false)   "false"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
      <dt><a name="imagePainter.id"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
      <dd>Unique identifier for the imagePainter.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
      <dt><a name="imagePainter.method"><samp>method</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
      <dd>Identifies the SynthPainter method this is to be used for. The name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
	corresponds to the method name of a paint method in SynthPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
	with the paint prefix dropped, the remainder is case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
	insensitive (using the latin1 case folding rules).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
	For example SynthPainter.paintButtonBackground is identified by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
	'buttonBackground' or 'buttonbackground'. If this is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
	not specified the painter is used for all methods that don't have a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
	a specific painter for them.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
      <dt><a name="imagePainter.direction"><samp>direction</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
      <dd>Identifies the direction, or orientation, this image is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
	used for. This is only useful for the SynthPainter methods that take
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
	a direction or orientation. If this is not specified the image is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
	used for all directions.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
      <dt><a name="imagePainter.path"><samp>path</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
      <dd>Path to the image. Path to the image.  If SynthLookAndFeel.load is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
    passed a Class this will use the Class method getResource (with with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
    Class suplied to the load method). If load is passed a URL this will use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
    URL constructor URL(context, path) to resolve the path.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
      <dt><a name="imagePainter.sourceInsets"><samp>sourceInsets</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
      <dd>Insets on the source image. This is top, left, bottom, right with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
	each component separated by a space.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
      <dt><a name="imagePainter.destinationInsets"><samp>destinationInsets</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
      <dd>Insets of the destination image. This is top, left, bottom, right with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
	each component separated by a space. If not specified the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
	<a href="#imagePainter.sourceInsets">sourceInsets</a> are used.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
      <dt><a name="imagePainter.painterCenter"><samp>paintCenter</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
      <dd>Whether or not the center of the image should be drawn.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
      <dt><a name="imagePainter.stretch"><samp>stretch</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
      <dd>Whether or not the north, south, east and west components of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
	resulting image should be scaled or tiled.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
      <dt><a name="imagePainter.center"><samp>center</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
      <dd>Whether or not the image is centered.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
      The <a href="#e.imagePainter">ImagePainter</a> element defines a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
      painter for the current style or state that will render using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
      the specified image.  ImagePainter offers two distinct rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
      modes.  The first mode is used to center an image in the space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
      provided.  This is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
      commonly used in rendering decorations on top of a widget, for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
      example, to specify an arrow for a scroll button use the center
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
      mode. The following example illustrates this:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
  &lt;imagePainter path="resources/myImage.png" center="true"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
      The second mode is used in scaling an image to fit in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
      provided space.  In this mode sourceInsets is used to specify a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
      border around an image where the north, south, east and west
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
      edges of the border are either stretched or tiled (stretch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
      attribute), the four corners of the border drawn in place, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
      the center is stretched.  In this mode you must specify
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
      sourceInsets.  The following example illustrates an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
      ImagePainter that is using the image MyImage.png and insets of 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
      all the way around:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
  &lt;imagePainter path="resources/myImage.png"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
                sourceInsets="2 2 2 2"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
      Refer to the description of the <a href="#e.painter">painter</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
      element for details as to the precedence in choosing a painter and to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
      understand how identical painters are handled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
	
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
    <h3>The imageIcon element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
&lt;!ELEMENT <a name="e.imageIcon">imageIcon</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
&lt;!ATTLIST imageIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
          <a href="#imageIcon.id">id</a>                    ID             #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
          <a href="#imageIcon.path">path</a>                  CDATA          #REQUIRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
      <dt><a name="imageIcon.id"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
      <dd>Unique identifier for the imageIcon.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
      <dt><a name="imageIcon.path"><samp>path</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
      <dd>Path to the image. This uses the Class method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
	getResource to resolve the path, with the Class supplied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
	SynthLookAndFeel.load.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
      <a href="#e.imageIcon">ImageIcon</a> is used to assign an Icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
      implementation that is wrapping an Image to a unique identifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
      This is typically used for properties that take an Icon. The following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
      example binds an ImageIcon to the property RadioButton.icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
  &lt;imageIcon id="icon" path="resources/myImage.png"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
  &lt;property key="RadioButton.icon" value="icon"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
   <h3>The opaque element</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
<div class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
<pre class="dtd-fragment">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
&lt;!ELEMENT <a name="e.opaque">opaque</a> EMPTY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
&lt;!ATTLIST opaque
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
          <a href="#opaque.value">value</a>              (true|false)   "true"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
    <p><em>Attribute definitions</em></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
    <dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
      <dt><a name="opaque.value"><samp>id</samp></a></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
      <dd>Whether or not the style should be opaque, if unspecified the style
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
	is opaque.</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
    </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
      The <a href="#e.opaque">opaque</a> element indicates whether or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
      not any Components the style is associated with are to be made opaque.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
      The painter will be asked to paint regardless of the opacity
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
      of the associated Component. The following example creates a style
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
      that is not opaque.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
&lt;style id="test">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
  &lt;opaque value="FALSE">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
  &lt;painter idref="painter"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
&lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
    </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
</div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
    <h3><a name="ee.beansPersistance">The beansPersistance entity</a></h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
      Beans persistance can be used to embed any Object. This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
      typically used for embedding your own Painters, but can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
      for other arbritrary objects as well. Refer to <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
							href="http://java.sun.com/products/jfc/tsc/articles/persistence3/">http://java.sun.com/products/jfc/tsc/articles/persistence3/</a> for details on beans persistance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
    <h3>Backing Style</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
    <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
      In creating a Synth file it's good practice to create a backing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
      style that is used by all components.  This will make sure that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
      any components that do not match a specific style will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
      a default font, foreground, background and opacity. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
      following example illustrates this:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
    <div class="example">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
      <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
&lt;synth>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
  &lt;style id="backingStyle">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
    &lt;opaque value="true"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
    &lt;font name="Dialog" size="12"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
    &lt;state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
      &lt;color value="BLACK" type="BACKGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
      &lt;color value="WHITE" type="FOREGROUND"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
    &lt;/state>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
  &lt;/style>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
  &lt;bind style="backingStyle" type="region" key=".*"/>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
&lt;/synth>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
      </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
    </div>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
  </body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
</html>