author | duke |
Wed, 05 Jul 2017 17:52:05 +0200 | |
changeset 10620 | 9df40a1578ef |
parent 5506 | 202f599c92aa |
child 31448 | 1066345d2a8a |
permissions | -rw-r--r-- |
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
4 |
* |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
8 |
* |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
14 |
* |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
22 |
*/ |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
23 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
24 |
/* |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
25 |
* @test |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
26 |
* @bug 6660049 6849518 |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
27 |
* @summary Tests the Region initialization |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
28 |
* @author Sergey Malenkov |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
29 |
*/ |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
30 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
31 |
import sun.awt.SunToolkit; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
32 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
33 |
import javax.swing.JButton; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
34 |
import javax.swing.JComponent; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
35 |
import javax.swing.SwingUtilities; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
36 |
import javax.swing.plaf.synth.Region; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
37 |
import javax.swing.plaf.synth.SynthLookAndFeel; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
38 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
39 |
public class Test6660049 implements Runnable { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
40 |
public static void main(String[] args) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
41 |
SwingUtilities.invokeLater(new Test6660049( |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
42 |
javax.swing.JButton.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
43 |
javax.swing.JCheckBox.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
44 |
javax.swing.JCheckBoxMenuItem.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
45 |
javax.swing.JColorChooser.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
46 |
javax.swing.JComboBox.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
47 |
javax.swing.JDesktopPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
48 |
javax.swing.JEditorPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
49 |
javax.swing.JFileChooser.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
50 |
javax.swing.JFormattedTextField.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
51 |
javax.swing.JInternalFrame.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
52 |
javax.swing.JLabel.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
53 |
javax.swing.JList.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
54 |
javax.swing.JMenu.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
55 |
javax.swing.JMenuBar.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
56 |
javax.swing.JMenuItem.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
57 |
javax.swing.JOptionPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
58 |
javax.swing.JPanel.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
59 |
javax.swing.JPasswordField.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
60 |
javax.swing.JPopupMenu.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
61 |
javax.swing.JProgressBar.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
62 |
javax.swing.JRadioButton.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
63 |
javax.swing.JRadioButtonMenuItem.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
64 |
javax.swing.JRootPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
65 |
javax.swing.JScrollBar.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
66 |
javax.swing.JScrollPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
67 |
javax.swing.JSeparator.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
68 |
javax.swing.JSlider.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
69 |
javax.swing.JSpinner.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
70 |
javax.swing.JSplitPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
71 |
javax.swing.JTabbedPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
72 |
javax.swing.JTable.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
73 |
javax.swing.JTextArea.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
74 |
javax.swing.JTextField.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
75 |
javax.swing.JTextPane.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
76 |
javax.swing.JToggleButton.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
77 |
javax.swing.JToolBar.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
78 |
javax.swing.JToolTip.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
79 |
javax.swing.JTree.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
80 |
javax.swing.JViewport.class, |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
81 |
javax.swing.table.JTableHeader.class)); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
82 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
83 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
84 |
private final Class<? extends JComponent>[] types; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
85 |
private final Region region; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
86 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
87 |
private Test6660049(Class<? extends JComponent>... types) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
88 |
this.types = types; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
89 |
run(); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
90 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
91 |
this.region = new Region("Button", "ButtonUI", true) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
92 |
@Override |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
93 |
public String getName() { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
94 |
throw new Error("6660049: exploit is available"); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
95 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
96 |
}; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
97 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
98 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
99 |
public void run() { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
100 |
if (this.region != null) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
101 |
SunToolkit.createNewAppContext(); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
102 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
103 |
for (Class<? extends JComponent> type : this.types) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
104 |
Region region = getRegion(type); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
105 |
if (region == null) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
106 |
throw new Error("6849518: region is not initialized"); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
107 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
108 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
109 |
getRegion(JButton.class).getName(); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
110 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
111 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
112 |
private static Region getRegion(Class<? extends JComponent> type) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
113 |
try { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
114 |
return SynthLookAndFeel.getRegion(type.newInstance()); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
115 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
116 |
catch (IllegalAccessException exception) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
117 |
throw new Error("unexpected exception", exception); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
118 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
119 |
catch (InstantiationException exception) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
120 |
throw new Error("unexpected exception", exception); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
121 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
122 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
diff
changeset
|
123 |
} |