jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html
author rupashka
Tue, 11 Jan 2011 12:51:33 +0300
changeset 7959 2e05332a8f5c
parent 2 90ce3da70b43
child 21254 f6d36ee3f269
permissions -rw-r--r--
6589952: Swing: dead links in API documentation Reviewed-by: alexp
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 3.2//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>Using the Multiplexing Look and Feel</TITLE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
</HEAD>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
<b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
<font size=+3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
Using the Multiplexing Look and Feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
</font>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
<hr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
<i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
This document is based on an article
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
originally published in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
<a href="http://java.sun.com/products/jfc/tsc/" target="_top"><em>The Swing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
Connection</em></a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
<hr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
The Multiplexing look and feel lets
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
you supplement an ordinary look and feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
(called the <em>default</em> look and feel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
with one or more <em>auxiliary</em> look and feels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
For example, you could
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
simultaneously provide text-to-speech and Braille outputs, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
in addition to the ordinary visual output that a Swing-based 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
application generates,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
by adding 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
two auxiliary look and feels (one for text-to-speech,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
the other for Braille)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
to the default look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
The default look and feel can be any ordinary look and feel --
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
the Java or Windows look and feel, for example --
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
and requires no modifications to work with auxiliary look and feels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
This document has the following sections:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
<li> <a href="#overview">Overview</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
<li> <a href="#howtouse">How to Use Auxiliary Look and Feels</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
<li> <a href="#howtowrite">Tips for Writing an Auxiliary Look and Feel</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     <li> <a href="#dosanddonts">Dos and Don'ts</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     <li> <a href="#uidefaults">Extending UIDefaults</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     <li> <a href="#defaultui">Examining Other UI Objects</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
<li> <a href="#implementation">How the Multiplexing Look and Feel is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     Implemented</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
<li> <a href="#custom">How to Provide a Custom Multiplexing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     Look and Feel</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
Before reading further, you should be familiar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
with the concept of pluggable look and feels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
For basic information, see
7959
2e05332a8f5c 6589952: Swing: dead links in API documentation
rupashka
parents: 2
diff changeset
    69
<a href="http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html">How to Set the Look and Feel</a>,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
a section in 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
<em>The Java Tutorial</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
For architectural details, you can read
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
<a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
href="http://java.sun.com/products/jfc/tsc/articles/architecture/#pluggable">Pluggable look-and-feel architecture</a>, a section within
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
a <em>Swing Connection</em> article.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
<a name="overview">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
<hr width=100% align=LEFT size=2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
<b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
<font color="#000080" size="+2">Overview</font>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
<p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
The classes in the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
<code>javax.swing.plaf.multi</code> package
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
implement a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
<i>multiplexing look and feel</i>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
A multiplexing look and feel transparently creates -- and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
simultaneously supports -- UI objects from several different look and feels
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
in response to a component requesting its UI object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
(with the <code>getUI</code> method).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
Without a multiplexing look and feel, a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
developer who wanted to enhance a particular look and feel would 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
need to extend the classes supporting that look and feel. For example, to 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
add text-to-speech support to the Java look and feel without using a multiplexing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
look and feel, the developer would need to create a group of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
classes that extend those of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
the Java look and feel, and add text-to-speech support to the new classes. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
If the developer also wanted to add text-to-speech support to other look
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
and feels, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
such as Motif or Windows, the developers would need to create subclasses 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
of those classes as well.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
This approach has at least two shortcomings: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
<ul type="DISC">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  <li>First, each subclass must use what is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      essentially a copy of the same code, potentially creating a difficult 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
      support situation for the developer.<br></li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  <li>Second, and more significantly for the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
      end user, some application developers might force a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
      particular look and feel to be used. When this approach is used, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
      the end user can't even use the enhanced look and feel.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
A multiplexing look and feel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
both these problems simultaneously because it allows multiple look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
and feels to be combined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
The first problem (having to use what amounts to a second copy of the same 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
code) is solved because the developer can create a specialized look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
and feel that can then be combined with other look and feels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
The second problem (having to force the use of 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
a particular look and feel) is solved because a specialized look and feel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
can be used with whatever default look and feel the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
application may have locked in place.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
The default multiplexing look and feel implementation, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
represented by the <code>MultiLookAndFeel</code> class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
in the <code>javax.swing.plaf.multi</code> package,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
is called (unsurprisingly) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
the Multiplexing look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
<a name="howtouse">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
<hr width=100% align=LEFT size=2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
<b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
<font color="#000080" size="+2">How to Use Auxiliary Look and Feels</font>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
<p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
It's easy to use auxiliary look and feels with Swing. To instruct 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
Swing to use the Multiplexing look and feel, all an application 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
has to do is modify the <code>$JDKHOME/lib/swing.properties</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
file to include a definition of the <code>swing.auxiliarylaf</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
property. Swing treats the <code>swing.auxiliarylaf</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
property as a comma-separated list of <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
subclasses that specify what auxiliary look and feels should be 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
used in addition to the default look and feel. If at least one valid 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
<code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
subclass is specified in the <code>swing.auxiliarylaf</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
property, Swing automatically uses the Multiplexing look and feel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
to load and support the default and auxiliary look and feels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
For example, let's assume that an application 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
makes use of a look and feel that supports text-to-speech feedback, and also 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
uses an look and feel that adds support for a device
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
that emits perfume.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
Let's assume that the text-to-speech
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
look and feel is named <code>com.myco.TextTalkerLookAndFeel</code>, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
and the look and feel that adds support for perfume
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
is named <code>com.smellco.OlfactoryLookAndFeel</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
To tell Swing to use both these look and feels 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
-- and to use a default look and feel at the same time -- your application 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
could simply add the following line to the <code>$JDKHOME/lib/swing.properties</code> file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
<code>&nbsp;&nbsp;&nbsp; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
              swing.auxiliarylaf=com.myco.TextTalkerLookAndFeel,<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.smellco.OlfactoryLookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
This statement tells Swing to obtain a component's UI from the Multiplexing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
look and feel automatically, instead of obtaining it directly from 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
the default look and feel. The resulting multiplexing UI is a small 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
delegate that obtains and maintains UIs from the default and auxiliary 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
look and feels. As a result, when a method is invoked in a multiplexing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
UI object, the multiplexing UI invokes the same method on each 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
of the UIs obtained from the default and auxiliary look and feels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
<a name="howtowrite">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
<hr width=100% align=LEFT size=2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
<b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
<font color="#000080" size="+2">Tips for Writing an Auxiliary Look and Feel</font>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
<p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
An auxiliary look and feel is like any other look and feel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
except that it doesn't have to provide the complete support 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
that a default look and feel must. For 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
example, an auxiliary look and feel that supports just text-to-speech feedback 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
doesn't need to provide any code for painting. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
Also, it might not need to support all components --
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
<code>JSeparator</code>s, for example, might be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
Auxiliary look and feels tend to be simple,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
so developing one can be easier than developing a visual 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
The developer can concentrate solely 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
on providing the specialized functionality. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
Because the primary purpose of an auxiliary look and feel is to enhance the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
default look and feel, auxiliary look and feels tend 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
be nonvisual. Since an auxiliary look and feel is a genuine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
look and feel, however, there is nothing to prevent it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
from rendering information on the display.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
Just like for any other look and feel, you
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
implement an auxiliary look and feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
by writing a subclass of <code>javax.swing.LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
and creating subclasses of the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
<code><em>Foo</em>UI</code> classes defined in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
the <code>javax.swing.plaf</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
<a name="dosanddonts">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
<font color="#000080" size="+1"><b>Dos and Don'ts</b></font> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
<p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
The following paragraphs provide some general recommendations for developing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
auxiliary look and feels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
<font color="#000080"><b>Use the <code>installUI</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
to perform all initialization,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
and the <code>uninstallUI</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
to perform all cleanup.</b></font>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
</font>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
The <code>installUI</code> and <code>uninstallUI</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
methods are invoked when a component's look and feel is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
The <code>installUI</code> method gives the new UI object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
a chance to add listeners on the component and its data model.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
Similarly, the <code>uninstallUI</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
lets the previous UI object remove its listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            <p> <font color="#000080"><b>Don't extend 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
              visual look and feels.</b></font></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
              <p> We recommended that you <i>don't</i> implement 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                UI classes of an auxiliary look and feel as subclasses of the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                UI classes of a visual look and feel. Why not? Because they might 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                accidentally inherit code that installs listeners on a component 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                object or renders the component on the display. As a result, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                your auxiliary look and feel would compete with the default look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                and feel rather than cooperating with it.<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                <br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                Instead, we recommend that the UI classes of an auxiliary look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
                and feel directly extend the abstract UI classes in the <code>javax.swing.plaf</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                package. By using this strategy, the developer of an auxiliary 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                look and feel can avoid competing with the default look and feel.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            <p> <font color="#000080"><b>Override all UI-specific methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
	    your UI classes inherit.</b></font>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
	    </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
              <p> We recommend that each UI class of 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                an auxiliary look and feel override the methods 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
		defined in the <code>javax.swing.plaf</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                UI classes it descends from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
		The reasons for this recommendation are similar 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                to those for not extending a visual look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                For example, the <code>ComponentUI</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                class, from which all UI classes descend,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
		provides a default implementation for the <code>update</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                method. This default implementation paints on the display
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
		if the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                component is opaque. If a UI class from a non-visual auxiliary 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                look and feel does not override this method, all 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                opaque components appear as blank areas on the screen!</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            <p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
<a name="uidefaults">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
<font color="#000080" size="+1"><b>Extending UIDefaults</b></font> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            <p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            <p>In many cases, you 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
              might want an auxiliary look and feel to be &quot;incomplete.&quot; That 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
              is, you might not need to support the complete set 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
              of components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            For example, an auxiliary look and feel might choose 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
	    to provide a <code>ButtonUI</code> subclass but no 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
              <code>LabelUI</code> subclass.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
	     This 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
              option is allowed, and the multiplexing look and feel gracefully 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
              handles such situations.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            <p>By default, however, Swing issues an error message when it asks 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
              a look and feel for a UI object and the look and feel does not 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
              support that UI. This message can be annoying, especially to auxiliary 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
              look-and-feel developers who don't want to support a particular 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
              component.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
            <p>Fortunately, you can prevent this error 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
              message by creating a subclass of the <code>UIDefaults</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
              class and returning an instance of it from the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
	      <code>getDefaults</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
	      of your <code>LookAndFeel</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
	      For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
	      </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            <p><code>public class MyAuxLookAndFeel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
              extends LookAndFeel {<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
                  ...<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                  public UIDefaults getDefaults() {<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                      <b>UIDefaults table = <br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
              new MyAuxUIDefaults();<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
              </b>        Object[] uiDefaults = {<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                        &quot;ButtonUI&quot;, &quot;MyAuxButtonUI&quot;,<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                        ...<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                      }<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
                      table.putDefaults(uiDefaults);<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                      return table;<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                  }<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
              }<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
              <br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
              <b>class MyAuxUIDefaults extends UIDefaults {<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                  protected void getUIError(String msg) {<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                      //System.err.println<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp; (&quot;An 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
              annoying message!&quot;);<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
                  }<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
              }</b></code></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
In the preceding example, an auxiliary look and feel named <code>MyAux</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
              creates a <code>UIDefaults</code> subclass 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
              that overrides the <code>getUIError</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
              method. The <code>getUIError</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
              method is the method that is invoked when Swing cannot find a UI 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
              object in a look and feel. By merely doing nothing in this method, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
              you can avoid the error message.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
            <p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
<a name="defaultui">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
<b><font color="#000080" size="+1">Examining Other UI Objects</font></b> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
<p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
            <p>In 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
              rare instances, a UI object from an auxiliary look and feel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
              may be interested in the default UI object used by the component. In 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
              these cases, the UI object from auxiliary look and feel can obtain 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
              the UI from a component by calling its <code>getUI</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
              method. The returned UI is an instance of one of the multiplexing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
              look and feel UI classes (for example, <code>MultiButtonUI</code>). 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
              The UI object from the auxiliary look and feel can call the <code>getUIs</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
              method of the returned object to obtain an array containing a complete list 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
              of all UI objects handled by the multiplexing UI. The first element 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
              is guaranteed to be the UI created from the default look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
	      </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
<a name="implementation">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
<hr width=100% align=LEFT size=2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
<font color="#000080" size="+2"><b>How the Multiplexing Look and Feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
Is Implemented</b></font> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
<p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
The Multiplexing look and feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
(represented by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
<code>javax.swing.plaf.multi.MultiLookAndFeel</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
is meant to be transparent to 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
all developers and users. It should &quot;just work&quot; -- and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
              it is used only when the user tells Swing to use an auxiliary look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
              and feel.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
              When the Multiplexing look and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
              feel is in use, the type of the UI object 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
	      associated with each component 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
	      depends on whether 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
	      any of the auxiliary look and feels currently in use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
	      support the component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
	      If so, the component's UI object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
	      an instance of a multiplexing UI.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
	      If only the default look and feel supports the component,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
	      then the component gets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
              a UI object from the default look and feel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
	      just as if no auxiliary look and feels were installed. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
	      <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
	      A multiplexing UI object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
              obtains and maintains UI objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
	      from the default and auxiliary look
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
	      and feels,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
              referring to these UIs in the following manner: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
<ul type="DISC">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
              <li> The UI object from the default look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                and feel is always the first to be created. After that, a UI object 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                is created from each auxiliary look and feel in the order 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                they are specified in the <code>swing.auxiliarylaf</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                property.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
              <li> When a method that requests information 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                from a UI object is invoked, the multiplexing UI object 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
		invokes the method on all the UI objects, but returns 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                only the results from the UI for the default look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                For example, when the <code>getPreferredSize</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                method is invoked on a multiplexing UI, the UI returns only the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                results of invoking <code>getPreferredSize</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                on the UI obtained from the default look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
		The <code>getPreferredSize</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
		is also invoked on the UI object for each auxiliary look and feel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
		but the return values are ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
                </li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
              <li> When a method that does not request information 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                from the UI object is invoked, the multiplexing UI object 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                invokes that method on all UIs --
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
		on the UI object obtained from the default look
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
		and feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
                and on all the UIs obtained from the auxiliary look and feels,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
		as well. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
                For example, invoking the <code>installUI</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
                method on a multiplexing UI causes the multiplexing UI to invoke 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
                <code>installUI</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
                on the UI obtained from the default look and feel and the UIs obtained from 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
                the auxiliary factories.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
            <p> In all cases, the UI object obtained from 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
              the default look and feel is acted upon first, and then the auxiliary 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
              look and feels are acted upon in the order they are specified in 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
              the <code>swing.auxiliarylaf</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
              property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
<a name="custom">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
<hr width=100% align=LEFT size=2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
<font color="#000080" size="+2"><b>How to Provide a Custom Multiplexing Look
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
and Feel</b></font> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
<p></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            <p><font color="#000080" size="+2"><b></b></font>While 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
              we hope the behavior of the Multiplexing look and feel is 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
              flexible enough not to require an alternative multiplexing look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
              and feel, Swing allows the user to specify another multiplexing look 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
              and feel to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
            <p> To do that, all the user has to do is modify 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
              the <code>$JDKHOME/lib/swing.properties</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
              file to include a definition of the <code>swing.plaf.multiplexinglaf</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
              property. Swing then treats the <code>swing.plaf.multiplexinglaf</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
              property as a <code>LookAndFeel</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
              subclass that supports multiplexing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
            <p> For example, if a user has a multiplexing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
              look and feel represented by <code>com.myco.SuperMultiLookAndFeel</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
              that is a better match for their needs than the Multiplexing 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
              look and feel 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
	      (<code>javax.swing.plaf.multi.MultiLookAndFeel</code>), 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
              the user could include the following line in <code>$JDKHOME/lib/swing.properties</code>:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
<code>swing.plaf.multiplexinglaf = com.myco.SuperMultiLookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
This statement instructs Swing to use <code>com.myco.SuperMultiLookAndFeel</code> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
instead of <code>javax.swing.plaf.multi.MultiLookAndFeel</code>. But 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
if you use this kind of statement, be careful, because the suppliers 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
of auxiliary look and feels will most likely have developed and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
tested against our Multiplexing look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
</BODY>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
</HTML>