use of javax.swing.UnsupportedLookAndFeelException in project jdk8u_jdk by JetBrains.
the class Metalworks method main.
public static void main(String[] args) {
UIManager.put("swing.boldMetal", Boolean.FALSE);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame.setDefaultLookAndFeelDecorated(true);
Toolkit.getDefaultToolkit().setDynamicLayout(true);
System.setProperty("sun.awt.noerasebackground", "true");
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
System.out.println("Metal Look & Feel not supported on this platform. \n" + "Program Terminated");
System.exit(0);
}
JFrame frame = new MetalworksFrame();
frame.setVisible(true);
}
use of javax.swing.UnsupportedLookAndFeelException in project android-classyshark by google.
the class GuiMode method buildAndShowClassyShark.
private static void buildAndShowClassyShark(List<String> cmdLineArgs) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (UnsupportedLookAndFeelException | IllegalAccessException | ClassNotFoundException | InstantiationException | SecurityException ex) {
ex.printStackTrace();
}
JFrame frame = buildClassySharkFrame(cmdLineArgs);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
theme.applyTo(frame);
}
use of javax.swing.UnsupportedLookAndFeelException in project zaproxy by zaproxy.
the class GuiBootstrap method setupLookAndFeel.
/**
* Setups Swing's look and feel.
* <p>
* <strong>Note:</strong> Should be called only after calling {@link #initModel()}, if not initialising ZAP for the
* {@link #isFirstTime() first time}. The look and feel set up might initialise some network classes (e.g.
* {@link java.net.InetAddress InetAddress}) preventing some ZAP options from being correctly applied.
*/
private void setupLookAndFeel() {
if (lookAndFeelSet) {
return;
}
lookAndFeelSet = true;
String lookAndFeelClassname = System.getProperty("swing.defaultlaf");
if (lookAndFeelClassname != null) {
try {
UIManager.setLookAndFeel(lookAndFeelClassname);
return;
} catch (final UnsupportedLookAndFeelException | ClassNotFoundException | ClassCastException | InstantiationException | IllegalAccessException e) {
logger.warn("Failed to set the specified look and feel: " + e.getMessage());
}
}
try {
// Set the systems Look and Feel
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
if (Constant.isMacOsX()) {
OsXGui.setup();
} else {
// Set Nimbus LaF if available
for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
}
} catch (final UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
logger.warn("Failed to set the \"default\" look and feel: " + e.getMessage());
}
}
use of javax.swing.UnsupportedLookAndFeelException in project jdk8u_jdk by JetBrains.
the class bug8136998 method iterateLookAndFeels.
protected static void iterateLookAndFeels(final bug8136998 test) throws Exception {
LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
for (LookAndFeelInfo info : lafInfo) {
try {
UIManager.setLookAndFeel(info.getClassName());
System.out.println("Look and Feel: " + info.getClassName());
test.runTest();
} catch (UnsupportedLookAndFeelException e) {
System.out.println("Skipping unsupported LaF: " + info);
}
}
}
use of javax.swing.UnsupportedLookAndFeelException in project jdk8u_jdk by JetBrains.
the class bug8046391 method main.
public static void main(String[] args) throws Exception {
OSType type = OSInfo.getOSType();
if (type != OSType.WINDOWS) {
System.out.println("This test is for Windows only... skipping!");
return;
}
SwingUtilities.invokeAndWait(() -> {
try {
UIManager.setLookAndFeel(new WindowsLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
System.out.println("Creating JFileChooser...");
JFileChooser fileChooser = new JFileChooser();
System.out.println("Test passed: chooser = " + fileChooser);
});
// Test fails if creating JFileChooser hangs
}
Aggregations