Search in sources :

Example 6 with UnsupportedLookAndFeelException

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);
}
Also used : UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) JFrame(javax.swing.JFrame) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel)

Example 7 with UnsupportedLookAndFeelException

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);
}
Also used : UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) JFrame(javax.swing.JFrame)

Example 8 with UnsupportedLookAndFeelException

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());
    }
}
Also used : UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo)

Example 9 with UnsupportedLookAndFeelException

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);
        }
    }
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException)

Example 10 with UnsupportedLookAndFeelException

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
}
Also used : UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) JFileChooser(javax.swing.JFileChooser) OSType(sun.awt.OSInfo.OSType) WindowsLookAndFeel(com.sun.java.swing.plaf.windows.WindowsLookAndFeel)

Aggregations

UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)13 LookAndFeelInfo (javax.swing.UIManager.LookAndFeelInfo)4 NimbusLookAndFeel (javax.swing.plaf.nimbus.NimbusLookAndFeel)3 JFrame (javax.swing.JFrame)2 LookAndFeel (javax.swing.LookAndFeel)2 MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)2 Plastic3DLookAndFeel (com.jgoodies.looks.plastic.Plastic3DLookAndFeel)1 PlasticLookAndFeel (com.jgoodies.looks.plastic.PlasticLookAndFeel)1 ExperienceBlue (com.jgoodies.looks.plastic.theme.ExperienceBlue)1 SkyBluer (com.jgoodies.looks.plastic.theme.SkyBluer)1 WindowsLookAndFeel (com.sun.java.swing.plaf.windows.WindowsLookAndFeel)1 Color (java.awt.Color)1 Graphics (java.awt.Graphics)1 Rectangle (java.awt.Rectangle)1 Robot (java.awt.Robot)1 BufferedImage (java.awt.image.BufferedImage)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 SQLException (java.sql.SQLException)1 HashSet (java.util.HashSet)1 Preferences (java.util.prefs.Preferences)1