author | dcubed |
Wed, 20 Jun 2012 14:18:25 -0700 | |
changeset 13092 | 3b4aad065f27 |
parent 6374 | e214162c907e |
permissions | -rw-r--r-- |
5585
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
1 |
/* |
6374
e214162c907e
6982137: Rebranding pass 2 - missed copyright changes
ohair
parents:
5585
diff
changeset
|
2 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
5585
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
4 |
* |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
8 |
* |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
13 |
* accompanied this code). |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
14 |
* |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
18 |
* |
6374
e214162c907e
6982137: Rebranding pass 2 - missed copyright changes
ohair
parents:
5585
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e214162c907e
6982137: Rebranding pass 2 - missed copyright changes
ohair
parents:
5585
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e214162c907e
6982137: Rebranding pass 2 - missed copyright changes
ohair
parents:
5585
diff
changeset
|
21 |
* questions. |
5585
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
22 |
*/ |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
23 |
|
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
24 |
/* @test |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
25 |
* @bug 6953396 |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
26 |
* @summary javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
27 |
* @author Alexander Potochkin |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
28 |
*/ |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
29 |
|
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
30 |
import javax.swing.*; |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
31 |
import javax.swing.plaf.basic.BasicViewportUI; |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
32 |
|
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
33 |
public class bug6953396 { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
34 |
static volatile boolean flag; |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
35 |
|
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
36 |
public static void main(String[] args) throws Exception { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
37 |
SwingUtilities.invokeAndWait(new Runnable() { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
38 |
@Override |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
39 |
public void run() { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
40 |
BasicViewportUI ui = new BasicViewportUI() { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
41 |
|
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
42 |
@Override |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
43 |
protected void installDefaults(JComponent c) { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
44 |
super.installDefaults(c); |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
45 |
flag = true; |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
46 |
} |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
47 |
|
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
48 |
@Override |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
49 |
protected void uninstallDefaults(JComponent c) { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
50 |
super.uninstallDefaults(c); |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
51 |
flag = false; |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
52 |
} |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
53 |
}; |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
54 |
|
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
55 |
JViewport viewport = new JViewport(); |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
56 |
viewport.setUI(ui); |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
57 |
viewport.setUI(null); |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
58 |
} |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
59 |
}); |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
60 |
if (flag) { |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
61 |
throw new RuntimeException("uninstallDefaults() hasn't been called"); |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
62 |
} |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
63 |
} |
b622f069ee7d
6953396: javax.swing.plaf.basic.BasicViewportUI.uninstallDefaults() is not called when UI is uninstalled
alexp
parents:
diff
changeset
|
64 |
} |