类javax.swing.UnsupportedLookAndFeelException源码实例Demo

下面列出了怎么用javax.swing.UnsupportedLookAndFeelException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk8u-jdk   文件: bug8046391.java
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
}
 
源代码2 项目: constellation   文件: GlyphsFrame.java
/**
 * @param args the command line arguments
 * @throws java.io.IOException
 */
public static void main(String[] args) throws IOException {
    final String[] fontNames = loadText("fonts.txt", true);
    final String[] text = loadText("text.txt", false);

    final ParsedFontInfo pfi = FontInfo.parseFontInfo(fontNames, GlyphManagerBI.DEFAULT_FONT_SIZE);

    if (!pfi.messages.isEmpty()) {
        System.out.printf("ParsedFontInfo message: %s\n", pfi.getMessages());
    }

    try {
        /* Set the system look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        //</editor-fold>
    } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
        Logger.getLogger(GlyphsFrame.class.getName()).log(Level.SEVERE, null, ex);
    }

    /* Create and display the form */
    EventQueue.invokeLater(() -> {
        new GlyphsFrame(pfi.fontsInfo, text).setVisible(true);
    });
}
 
源代码3 项目: jdk8u-jdk   文件: MenuItemIconTest.java
public static void main(String[] args) throws Exception {
    robot = new Robot();
    String name = UIManager.getSystemLookAndFeelClassName();
    try {
        UIManager.setLookAndFeel(name);
    } catch (ClassNotFoundException | InstantiationException |
            IllegalAccessException | UnsupportedLookAndFeelException e) {
        throw new RuntimeException("Test Failed");
    }
    createUI();
    robot.waitForIdle();
    executeTest();
    if (!"".equals(errorMessage)) {
        throw new RuntimeException(errorMessage);
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: Metalworks.java
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);
}
 
源代码5 项目: dragonwell8_jdk   文件: bug8046391.java
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
}
 
源代码6 项目: dragonwell8_jdk   文件: MenuItemIconTest.java
public static void main(String[] args) throws Exception {
    robot = new Robot();
    String name = UIManager.getSystemLookAndFeelClassName();
    try {
        UIManager.setLookAndFeel(name);
    } catch (ClassNotFoundException | InstantiationException |
            IllegalAccessException | UnsupportedLookAndFeelException e) {
        throw new RuntimeException("Test Failed");
    }
    createUI();
    robot.waitForIdle();
    executeTest();
    if (!"".equals(errorMessage)) {
        throw new RuntimeException(errorMessage);
    }
}
 
源代码7 项目: IrScrutinizer   文件: HarcletFrame.java
/**
 * Creates new form
 * @param panel
 * @param exitOnClose
 * @param lafClassName
 */
public HarcletFrame(HarcPanel panel, boolean exitOnClose, String lafClassName) {
    try {
        if (lafClassName != null)
            UIManager.setLookAndFeel(lafClassName);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
        //error(ex);
    }
    this.exitOnClose = exitOnClose;
    harclet = panel;
    initComponents();
    super.setTitle(harclet.getProgName());

    super.setIconImage((new ImageIcon(HarcletFrame.class.getResource(harclet.getIconPath()))).getImage());
    super.setResizable(false);

    if (exitOnClose) {
        super.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    }
}
 
源代码8 项目: jdk8u_jdk   文件: bug8046391.java
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
}
 
源代码9 项目: mapleLemon   文件: DebugWindow.java
public static void main(String[] args) {
    try {
        for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
        Logger.getLogger(DebugWindow.class.getName()).log(Level.SEVERE, null, ex);
    }

    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            new DebugWindow().setVisible(true);
        }
    });
}
 
源代码10 项目: jdk8u60   文件: Metalworks.java
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);
}
 
源代码11 项目: openjdk-jdk9   文件: Test7022041.java
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
    // try to test all installed Look and Feels
    for (UIManager.LookAndFeelInfo lookAndFeel : installedLookAndFeels) {
        String name = lookAndFeel.getName();
        System.out.println("Testing " + name);
        // Some Look and Feels work only when test is run in a GUI environment
        // (GTK+ LAF is an example)
        try {
            UIManager.setLookAndFeel(lookAndFeel.getClassName());
            checkTitleColor();
            System.out.println("    titleColor test ok");
            checkTitleFont();
            System.out.println("    titleFont test ok");
        }
        catch (UnsupportedLookAndFeelException e) {
            System.out.println("    Note: LookAndFeel " + name
                             + " is not supported on this configuration");
        }
    }
}
 
源代码12 项目: jdk8u60   文件: bug8046391.java
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
}
 
源代码13 项目: openjdk-jdk9   文件: bug8046391.java
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
}
 
源代码14 项目: openjdk-jdk8u   文件: MenuItemIconTest.java
public static void main(String[] args) throws Exception {
    robot = new Robot();
    String name = UIManager.getSystemLookAndFeelClassName();
    try {
        UIManager.setLookAndFeel(name);
    } catch (ClassNotFoundException | InstantiationException |
            IllegalAccessException | UnsupportedLookAndFeelException e) {
        throw new RuntimeException("Test Failed");
    }
    createUI();
    robot.waitForIdle();
    executeTest();
    if (!"".equals(errorMessage)) {
        throw new RuntimeException(errorMessage);
    }
}
 
源代码15 项目: jdk8u-jdk   文件: Test7022041.java
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
    // try to test all installed Look and Feels
    for (UIManager.LookAndFeelInfo lookAndFeel : installedLookAndFeels) {
        String name = lookAndFeel.getName();
        System.out.println("Testing " + name);
        // Some Look and Feels work only when test is run in a GUI environment
        // (GTK+ LAF is an example)
        try {
            UIManager.setLookAndFeel(lookAndFeel.getClassName());
            checkTitleColor();
            System.out.println("    titleColor test ok");
            checkTitleFont();
            System.out.println("    titleFont test ok");
        }
        catch (UnsupportedLookAndFeelException e) {
            System.out.println("    Note: LookAndFeel " + name
                             + " is not supported on this configuration");
        }
    }
}
 
源代码16 项目: jdk8u-dev-jdk   文件: bug8046391.java
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
}
 
源代码17 项目: FastAsyncWorldedit   文件: JSystemFileChooser.java
public void updateUI(){
    LookAndFeel old = UIManager.getLookAndFeel();
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Throwable ex) {
        old = null;
    }

    super.updateUI();

    if(old != null){
        FilePane filePane = findFilePane(this);
        filePane.setViewType(FilePane.VIEWTYPE_DETAILS);
        filePane.setViewType(FilePane.VIEWTYPE_LIST);

        Color background = UIManager.getColor("Label.background");
        setBackground(background);
        setOpaque(true);

        try {
            UIManager.setLookAndFeel(old);
        }
        catch (UnsupportedLookAndFeelException ignored) {} // shouldn't get here
    }
}
 
源代码18 项目: hottub   文件: bug8046391.java
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
}
 
源代码19 项目: HubPlayer   文件: Main.java
public static void main(String[] args) {

		try {
			// 设置观感
			UIManager
					.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel");
			// 设置水印
			SubstanceLookAndFeel
					.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceMosaicWatermark");
			// 设置渐变渲染
			SubstanceLookAndFeel
					.setCurrentGradientPainter("org.jvnet.substance.painter.WaveGradientPainter");

			JFrame.setDefaultLookAndFeelDecorated(true);
			JDialog.setDefaultLookAndFeelDecorated(true);
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}

		EventQueue.invokeLater(() -> {
			new HubFrame();
		});

	}
 
源代码20 项目: jdk8u-jdk   文件: bug8046391.java
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
}
 
源代码21 项目: openjdk-jdk8u-backup   文件: Metalworks.java
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);
}
 
源代码22 项目: jeveassets   文件: Main.java
private static void initLookAndFeel() {
	//Allow users to overwrite LaF
	if (System.getProperty("swing.defaultlaf") != null) {
		return;
	}
	String lookAndFeel;
	//lookAndFeel = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
	lookAndFeel = UIManager.getSystemLookAndFeelClassName(); //System
	//lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); //Java
	//lookAndFeel = "javax.swing.plaf.nimbus.NimbusLookAndFeel"; //Nimbus
	//lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; //Metal
	//lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; //GTK+
	//lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; //CDE/Motif
	try {
		UIManager.setLookAndFeel(lookAndFeel);
	} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
		log.log(Level.SEVERE, "Failed to set LookAndFeel: " + lookAndFeel, ex);
	}
}
 
源代码23 项目: openjdk-jdk8u-backup   文件: bug8046391.java
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
}
 
源代码24 项目: sheepit-client   文件: Settings.java
private void applyTheme(String theme_) {
	try {
		if (theme_.equals("light")) {
			UIManager.setLookAndFeel(new FlatLightLaf());
		}
		else if (theme_.equals("dark")) {
			UIManager.setLookAndFeel(new FlatDarkLaf());
		}
		
		// Apply the new theme
		FlatLaf.updateUI();
	}
	catch (UnsupportedLookAndFeelException e1) {
		e1.printStackTrace();
	}
}
 
源代码25 项目: brModelo   文件: Aplicacao.java
private static void initLookAndFeel() {
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        util.BrLogger.Logger("ERROR_APP_LOAD_UI", ex.getMessage());
    }

}
 
源代码26 项目: hottub   文件: bug8033069NoScrollBar.java
protected static void iterateLookAndFeels(final bug8033069NoScrollBar 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);
        }
    }
}
 
源代码27 项目: openjdk-jdk9   文件: SilenceOfDeprecatedMenuBar.java
private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) {
    try {
        UIManager.setLookAndFeel(laf.getClassName());
        System.out.println("LookAndFeel: " + laf.getClassName());
    } catch (ClassNotFoundException | InstantiationException |
            UnsupportedLookAndFeelException | IllegalAccessException e) {
        throw new RuntimeException(e);
    }
}
 
源代码28 项目: keystore-explorer   文件: LnfUtil.java
/**
 * Use supplied l&f.
 *
 * @param lnfClassName
 *            L&f class name
 */
public static void useLnf(String lnfClassName) {
	try {
		UIManager.setLookAndFeel(lnfClassName);
	} catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException
			| IllegalAccessException e) {
		// ignore
	}
}
 
public static void main(String[] args) {
	ParameterService.init();
	EncryptionProvider.initialize();
	ParameterService.setParameterValue(RapidMinerGUI.PROPERTY_FONT_CONFIG, "Standard fonts");
	try {
		UIManager.setLookAndFeel(new RapidLookAndFeel());
	} catch (UnsupportedLookAndFeelException e) {
		e.printStackTrace();
	}
	JDialog dialog = new ParameterInjectionDialogExample();
	dialog.setVisible(true);
}
 
源代码30 项目: dragonwell8_jdk   文件: InsetsEncapsulation.java
private static void setLookAndFeel(final LookAndFeelInfo laf) {
    try {
        UIManager.setLookAndFeel(laf.getClassName());
        System.out.println("LookAndFeel: " + laf.getClassName());
    } catch (ClassNotFoundException | InstantiationException |
            UnsupportedLookAndFeelException | IllegalAccessException e) {
        throw new RuntimeException(e);
    }
}
 
 类所在包
 类方法
 同包方法