139 |
// Circumvent the package-privateness of the |
// Circumvent the package-privateness of the |
140 |
// java.awt.Font.Font(String,Map) constructor. |
// java.awt.Font.Font(String,Map) constructor. |
141 |
try |
try |
142 |
{ |
{ |
143 |
Constructor fontConstructor = Component.class.getConstructor |
Constructor fontConstructor = Component.class.getConstructor |
144 |
(new Class[] { String.class, Map.class }); |
(new Class[] { String.class, Map.class }); |
145 |
AccessController.doPrivileged |
AccessController.doPrivileged |
146 |
(new SetAccessibleAction(fontConstructor)); |
(new SetAccessibleAction(fontConstructor)); |
147 |
f = (Font) fontConstructor.newInstance(new Object[] { name, attrs }); |
f = (Font) fontConstructor.newInstance(new Object[] { name, attrs }); |
148 |
} |
} |
149 |
catch (IllegalAccessException e) |
catch (IllegalAccessException e) |
150 |
{ |
{ |
151 |
// This should never happen. |
throw new RuntimeException |
152 |
} |
("couldn't call java.awt.Font.Font(String,Map) constructor"); |
153 |
|
} |
154 |
catch (NoSuchMethodException e) |
catch (NoSuchMethodException e) |
155 |
{ |
{ |
156 |
// This should never happen. |
throw new RuntimeException |
157 |
} |
("couldn't call java.awt.Font.Font(String,Map) constructor"); |
158 |
|
} |
159 |
catch (InstantiationException e) |
catch (InstantiationException e) |
160 |
{ |
{ |
161 |
// This should never happen. |
throw new RuntimeException |
162 |
|
("couldn't call java.awt.Font.Font(String,Map) constructor"); |
163 |
} |
} |
164 |
catch (InvocationTargetException e) |
catch (InvocationTargetException e) |
165 |
{ |
{ |
166 |
// This should never happen. |
throw new RuntimeException |
167 |
|
("couldn't call java.awt.Font.Font(String,Map) constructor"); |
168 |
} |
} |
169 |
return f; |
return f; |
170 |
} |
} |