0

我想实现 Acryl Look and Feel,当我只运行文件时它运行良好,但是当我运行 Main Project 时它返回默认的 l&F。

public static void main(String args[]) {
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            /*if ("Windows".equals(info.getName())) {
             * javax.swing.UIManager.setLookAndFeel(info.getClassName());
             * break;
             * }*/
            UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
         }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
4

2 回答 2

2

您不必在代码中循环和设置 n 次。

就在你的主项目main()中放这条线。

UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
于 2013-08-02T14:28:40.767 回答
1

重新检查您设置的主类,例如登录表单可以是特定项目的主类。

于 2013-08-02T19:09:07.857 回答