1833N/A/*
5743N/A * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
1833N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1833N/A *
1833N/A * This code is free software; you can redistribute it and/or modify it
1833N/A * under the terms of the GNU General Public License version 2 only, as
1833N/A * published by the Free Software Foundation.
1833N/A *
1833N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1833N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1833N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1833N/A * version 2 for more details (a copy is included in the LICENSE file that
1833N/A * accompanied this code).
1833N/A *
1833N/A * You should have received a copy of the GNU General Public License version
1833N/A * 2 along with this work; if not, write to the Free Software Foundation,
1833N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1833N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1833N/A */
1833N/A
1833N/A/*
1833N/A * @test
5743N/A * @bug 6657026 7077259
1833N/A * @summary Tests shared MetalSliderUI in different application contexts
1833N/A * @author Sergey Malenkov
5743N/A * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel Test6657026
1833N/A */
1833N/A
1833N/Aimport javax.swing.JSlider;
1833N/Aimport javax.swing.UIManager;
1833N/Aimport javax.swing.plaf.metal.MetalLookAndFeel;
1833N/Aimport javax.swing.plaf.metal.MetalSliderUI;
5743N/Aimport sun.awt.SunToolkit;
1833N/A
1833N/Apublic class Test6657026 extends MetalSliderUI implements Runnable {
1833N/A
1833N/A public static void main(String[] args) throws Exception {
1833N/A JSlider slider = new JSlider();
1833N/A test(slider);
1833N/A
1833N/A ThreadGroup group = new ThreadGroup("$$$");
1833N/A Thread thread = new Thread(group, new Test6657026());
1833N/A thread.start();
1833N/A thread.join();
1833N/A
1833N/A test(slider);
1833N/A }
1833N/A
1833N/A public void run() {
1833N/A SunToolkit.createNewAppContext();
1833N/A JSlider slider = new JSlider();
1833N/A test(slider);
1833N/A tickLength = -10000;
1833N/A }
1833N/A
1833N/A private static void test(JSlider slider) {
1833N/A MetalSliderUI ui = (MetalSliderUI) slider.getUI();
1833N/A int actual = ui.getTickLength();
1833N/A if (actual != 11) {
1833N/A throw new Error(actual + ", but expected 11");
1833N/A }
1833N/A }
1833N/A}