Skip to content

Commit 535c166

Browse files
committed
8386795: Swing specification needs caveats on L&F rendering behaviors
Reviewed-by: kizune Backport-of: fe98e67
1 parent 312d3b3 commit 535c166

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/java.desktop/share/classes/javax/swing/UIManager.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,42 @@
158158
* expects certain defaults, so that in general
159159
* a {@code ComponentUI} provided by one look and feel will not
160160
* work with another look and feel.
161+
*
162+
* <h2>System Look and Feels</h2>
163+
*
164+
* [The terms "System", "Native" and "Platform" may be used interchangeably in this context].
165+
* <p>
166+
* A System Look And Feel is intended to implement the native Look and Feel of the desktop.
167+
* <p>
168+
* There is no requirement for the standard Java Look And Feel to be the default,
169+
* therefore the System Look and Feel may be the default.
170+
* <p>
171+
* A desktop may not have a consistent Look and Feel, for example if there are
172+
* multiple platform-native toolkits provided to create applications for the desktop.
173+
* Swing may elect any one of these to be its native Look and Feel.
174+
* <p>
175+
* Installation of the native Look and Feel may depend on platform resources being available.
176+
* In the event that required resources are not available, Swing may be unable to install
177+
* the System Look and Feel.
178+
* <p>
179+
* Swing's emulation of the native Look and Feel takes precedence over any component-specific
180+
* indication of rendering.
181+
* This means that a native Look and Feel should render in a way that is consistent with the platform,
182+
* even if it contradicts component setting-specific documentation.
183+
* Examples include
184+
* <ul>
185+
* <li>specified rendering of painted borders may be ignored
186+
* <li>specified rendering of highlighting effects may be ignored
187+
* <li>specified rendering of painted backgrounds and foregrounds may be ignored
188+
* <li>specified rendering of selected vs unselected components may be ignored
189+
* <li>specified rendering of enabled vs disabled components may be ignored
190+
* </ul>
191+
* These are just examples. Not an exhaustive list.
192+
* <p>
193+
* These caveats must not be construed as an excuse to arbitrarily ignore these properties.
194+
* They are intended to support the requirement that the platform Look and Feel be as
195+
* consistent with the native rendering as is practical.
196+
*
161197
* <p>
162198
* <strong>Warning:</strong>
163199
* Serialized objects of this class will not be compatible with

0 commit comments

Comments
 (0)