I want to change default value of object according to LookAndFeel.
For LookAndFeel on Java some has the same objects, but different value. Example:
Metal : javax.swing.plaf.metal.MetalLookAndFeel
Slider.background : javax.swing.plaf.ColorUIResource[r=238,g=238,b=238]
SliderUI : javax.swing.plaf.metal.MetalSliderUI
Nimbus : javax.swing.plaf.nimbus.NimbusLookAndFeel
Slider.background : DerivedColor(color=214,217,223 parent=control offsets=0.0,0.0,0.0,0 pColor=214,217,223
SliderUI : javax.swing.plaf.synth.SynthLookAndFeel
CDE/Motif : com.sun.java.swing.plaf.motif.MotifLookAndFeel
Slider.background : javax.swing.plaf.ColorUIResource[r=147,g=151,b=165]
SliderUI : com.sun.java.swing.plaf.motif.MotifSliderUI
GTK+ : com.sun.java.swing.plaf.gtk.GTKLookAndFeel
Slider.background : javax.swing.plaf.ColorUIResource[r=214,g=210,b=208]
SliderUI : javax.swing.plaf.synth.SynthLookAndFeel
Mac OS X : com.apple.laf.AquaLookAndFeel
Slider.background : com.apple.laf.AquaImageFactory$SystemColorProxy[r=238,g=238,b=238]
SliderUI : com.apple.laf.AquaSliderUI
Windows : com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Slider.background : javax.swing.plaf.ColorUIResource[r=240,g=240,b=240]
SliderUI : com.sun.java.swing.plaf.windows.WindowsSliderUI
Windows Classic : com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel
Slider.background : javax.swing.plaf.ColorUIResource[r=240,g=240,b=240]
SliderUI : com.sun.java.swing.plaf.windows.WindowsSliderUI
.
You can see that has the same object, in this case Slider.background but has different default values, according to LookAndFeel.
I want to know: how change default value (establishing another values different between them) for Nimbus, for Metal and Motif.
Example:
Metal -> Slider.background:Color.RED
Nimbus -> Slider.background:Color.GREEN
Motif -> Slider.background:Color.BLUE
The problem of next method is changes for all, but How select the specific LAF?
UIDefaults sliderDefaults = new UIDefaults();
sliderDefaults.put("Slider.background", THE_COLOR_SELECTED);
UIManager.put("Slider.background", THE_COLOR_SELECTED);
I don't want to set the LookAndFeel to change its value's component... I want to change before the LookAndFeel, and apply it later changed LAF (I don't know if is possible).
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
Suppose exist a method (this really doesn't work) like this:
UIManager.getLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel").put("Slider.background", Color.RED);
UIManager.getLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel").put("Slider.background", Color.GREEN);
UIManager.getLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel").put("Slider.background", Color.BLUE);
According to LookAndFeel, I'm establishing a different DEFAULT Color for the same object.
Note: The Color is only for demonstration porpoise, because I want to use the same principle to other types of objects.