-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b86
-
generic
-
generic
JDK: 7b78+
Platform: All
The following method of the class javax.swing.plaf.synth.SynthSliderUI
protected void uninstallDefaults()
Uninstalls default setting. This method is called when a LookAndFeel is uninstalled.
is not called as expected. Please see the following code sample:
---------------------------------------------------------------------------------------
import javax.swing.*;
import javax.swing.plaf.synth.SynthLookAndFeel;
import javax.swing.plaf.synth.SynthSliderUI;
public class Test {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
doTheTest();
}
});
}
private static void doTheTest() {
try {
UIManager.setLookAndFeel(new SynthLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
class _SynthSliderUI extends SynthSliderUI {
protected _SynthSliderUI(JSlider c) { super(c); }
@Override protected void installDefaults(JSlider slider) {
System.out.println("installDefaults");
super.installDefaults(slider);
}
@Override protected void installListeners(JSlider slider) {
System.out.println("installListeners");
super.installListeners(slider);
}
@Override protected void uninstallDefaults() {
System.out.println("uninstallDefaults");
super.uninstallDefaults();
}
@Override protected void uninstallListeners(JSlider slider) {
System.out.println("uninstallListeners");
super.uninstallListeners(slider);
}
}
JSlider slider = new JSlider();
_SynthSliderUI ui = new _SynthSliderUI(slider);
slider.setUI(ui);
slider.setUI(null);
}
}
---------------------------------------------------------------------------------------
The output will be:
installDefaults
installListeners
uninstallListeners
Platform: All
The following method of the class javax.swing.plaf.synth.SynthSliderUI
protected void uninstallDefaults()
Uninstalls default setting. This method is called when a LookAndFeel is uninstalled.
is not called as expected. Please see the following code sample:
---------------------------------------------------------------------------------------
import javax.swing.*;
import javax.swing.plaf.synth.SynthLookAndFeel;
import javax.swing.plaf.synth.SynthSliderUI;
public class Test {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
doTheTest();
}
});
}
private static void doTheTest() {
try {
UIManager.setLookAndFeel(new SynthLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
class _SynthSliderUI extends SynthSliderUI {
protected _SynthSliderUI(JSlider c) { super(c); }
@Override protected void installDefaults(JSlider slider) {
System.out.println("installDefaults");
super.installDefaults(slider);
}
@Override protected void installListeners(JSlider slider) {
System.out.println("installListeners");
super.installListeners(slider);
}
@Override protected void uninstallDefaults() {
System.out.println("uninstallDefaults");
super.uninstallDefaults();
}
@Override protected void uninstallListeners(JSlider slider) {
System.out.println("uninstallListeners");
super.uninstallListeners(slider);
}
}
JSlider slider = new JSlider();
_SynthSliderUI ui = new _SynthSliderUI(slider);
slider.setUI(ui);
slider.setUI(null);
}
}
---------------------------------------------------------------------------------------
The output will be:
installDefaults
installListeners
uninstallListeners