United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6604357 Nimbus L&F: Add componet customization via ClientProperties
6604357 : Nimbus L&F: Add componet customization via ClientProperties

Details
Type:
Bug
Submit Date:
2007-09-13
Status:
Closed
Updated Date:
2011-03-05
Project Name:
JDK
Resolved Date:
2007-12-17
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u5
Fixed Versions:
6u10

Related Reports
Duplicate:
Relates:
Relates:

Sub Tasks

Description
Would like to add the ability to modify what the NimbusStyle reports as values (painters, properties, etc) based on entries in UIDefaults AND in a component's client properties. The current scheme of customizing states based on named components in UI defaults is fine if you have a special named component that will be reused in many places. However, if you are doing a one-off design for a single component, this approach can lead to a polluted and cluttered UIDefaults table. Rather, it would be nice to associate the custom state with the component itself. Lacking public API, I propose using undocumented client properties for Java 6 (and documented properties or public API in Java 7). Any entry in client properties would override the corresponding entry in UIDefaults.

We would also like Nimbus to support the "JComponent.sizeVariant" client property to control component size. The name of the property and its values have been chosen to match Apple's LAF so we are compatable. The valid values for this key are "large", "small" and "mini". They designed to be used in tools pallets where space is a premium and small or mini components are needed or in wizards/dialogs where there is plenty of space and a larger conponents can be used. Look at the attched screenshot to see the effect of this setting. It is not designed to work perfectly with all components, only a few like JButton, JCheckBox, JRadioButton, JTextField, JComboBox, JSpinner, JprogressBar, JScrollBar and JSlider.

                                    

Comments
EVALUATION

For the "JComponent.sizeVariant" implementation a few aspects of a component need to be scaled. For all components the font size and insets are scaled. Then a few special properties such as "ProgressBar.horizontalSize" also need to be scaled. The special cases are done in the SynthUI deligates for the respective components. The choosen scale factors are "large"=115% "small"=85.7% and "mini"=71.4% these were chosen to match Apple's LAF.
                                     
2007-12-07
EVALUATION

Also found during debugging that the background colors are not being handled correctly by Synth. SynthStyle hard codes that only when the state is ENABLED (not ENABLED and MOUSE_OVER, or any other combination, only ENABLED) the background color applied by the developer is honored, otherwise it is ignored and the LAF background is used.

This is incorrect. As with all other Swing components and Swing look and feels, the background of the component should be honored when set by the developer, regardless of the state of the component.

The fix for this bug includes a fix for this background issue. You can see the bad.tiff and good.tiff images to see what has changed. In both cases, the buttons are set to be opaque, and given a background color of RED. PINK is the background color of the parent.
                                     
2007-10-11
EVALUATION

Implemented as outlined in the description. Specifically, we use "Nimbus.Overrides", "Nimbus.Overrides.InheritDefaults", and "Nimbus.State" client properties. It is extremely unlikely that these client properties are currently in use by any application.
                                     
2007-10-08



Hardware and Software, Engineered to Work Together