< prev index next >
src/java.desktop/share/classes/javax/swing/UIManager.java
Print this page
*** 524,541 ****
try {
for (LookAndFeelInfo info : installedLAFs) {
if (info.getName().equals(name)) {
Class<?> cls = Class.forName(UIManager.class.getModule(),
info.getClassName());
! LookAndFeel laf = (LookAndFeel) cls.newInstance();
if (!laf.isSupportedLookAndFeel()) {
break;
}
return laf;
}
}
! } catch (InstantiationException | IllegalAccessException ignore) {
}
throw new UnsupportedLookAndFeelException(name);
}
--- 524,543 ----
try {
for (LookAndFeelInfo info : installedLAFs) {
if (info.getName().equals(name)) {
Class<?> cls = Class.forName(UIManager.class.getModule(),
info.getClassName());
! LookAndFeel laf =
! (LookAndFeel) cls.getDeclaredConstructor().newInstance();
if (!laf.isSupportedLookAndFeel()) {
break;
}
return laf;
}
}
! } catch (ReflectiveOperationException |
! IllegalArgumentException ignore) {
}
throw new UnsupportedLookAndFeelException(name);
}
*** 623,633 ****
// Avoid reflection for the common case of metal.
setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
}
else {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
! setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));
}
}
/**
* Returns the name of the <code>LookAndFeel</code> class that implements
--- 625,644 ----
// Avoid reflection for the common case of metal.
setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
}
else {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
! try {
! LookAndFeel laf =
! (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
! setLookAndFeel(laf);
! } catch (ReflectiveOperationException | IllegalArgumentException e) {
! InstantiationException ex =
! new InstantiationException("Wrapped Exception");
! ex.initCause(e);
! throw ex;
! }
}
}
/**
* Returns the name of the <code>LookAndFeel</code> class that implements
*** 1091,1101 ****
if (multiLookAndFeel == null) {
String defaultName = "javax.swing.plaf.multi.MultiLookAndFeel";
String className = getLAFState().swingProps.getProperty(multiplexingLAFKey, defaultName);
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
! multiLookAndFeel = (LookAndFeel)lnfClass.newInstance();
} catch (Exception exc) {
System.err.println("UIManager: failed loading " + className);
}
}
return multiLookAndFeel;
--- 1102,1113 ----
if (multiLookAndFeel == null) {
String defaultName = "javax.swing.plaf.multi.MultiLookAndFeel";
String className = getLAFState().swingProps.getProperty(multiplexingLAFKey, defaultName);
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
! multiLookAndFeel =
! (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
} catch (Exception exc) {
System.err.println("UIManager: failed loading " + className);
}
}
return multiLookAndFeel;
*** 1425,1435 ****
while (p.hasMoreTokens()) {
String className = p.nextToken();
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
! LookAndFeel newLAF = (LookAndFeel)lnfClass.newInstance();
newLAF.initialize();
auxLookAndFeels.addElement(newLAF);
}
catch (Exception e) {
System.err.println("UIManager: failed loading auxiliary look and feel " + className);
--- 1437,1448 ----
while (p.hasMoreTokens()) {
String className = p.nextToken();
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
! LookAndFeel newLAF =
! (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
newLAF.initialize();
auxLookAndFeels.addElement(newLAF);
}
catch (Exception e) {
System.err.println("UIManager: failed loading auxiliary look and feel " + className);
< prev index next >