简体   繁体   English

如何在 NetBeans IDE 12.6 中设置 FlatLaf Light 外观和感觉

[英]How to set FlatLaf Light look and feel in NetBeans IDE 12.6

I haven't been able to find a solution to my problem for 3 days.我已经 3 天没能找到解决我的问题的方法了。 It's about adjusting the look and feel option for my project.这是关于为我的项目调整外观选项。 Nimbus and Metal do not suit my project and it turns out indescribably ugly while with FlatLaf Light it looks very nice because there are not many borders. Nimbus 和 Metal 不适合我的项目,结果变得难以形容,而使用 FlatLaf Light 看起来非常漂亮,因为没有太多边框。

When I type FlatLaf Light nothing changes, it stays the same, I tried to find the answers on the official site.当我输入 FlatLaf Light 时没有任何变化,它保持不变,我试图在官方网站上找到答案。 However, it was not successful.然而,它并不成功。

try {
     for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
       if ("Nimbus".equals(info.getName())) { //this 
             javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(LoginFormAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(LoginFormAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(LoginFormAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(LoginFormAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }

In a few simple steps I will explain the easiest possible:在几个简单的步骤中,我将解释最简单的方法:

  1. Enter this link: click me pls输入此链接:请点我
  2. Download FlatLaf 1.2, why not a new version idk下载FlatLaf 1.2,为什么不是新版本idk
  3. Create a folder in the folder where your project is located and insert the file there在项目所在的文件夹中创建一个文件夹并将文件插入其中
  4. Go to NetBeans Go 至 NetBeans
  5. Find your project, and find the Library section找到您的项目,然后找到 Library 部分
  6. Right-click and Add JAR / Folder and add FlatLaf 1.2右键单击并添加 JAR / 文件夹并添加 FlatLaf 1.2
  7. Go to JFrame or anything in Main and insert this instead: Go 到 JFrame 或 Main 中的任何内容,然后将其插入:

New fresh beautiful code新的鲜美代码

    public static void main(String args[]) {
    try {
        UIManager.setLookAndFeel(new FlatIntelliJLaf());
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Interface().setVisible(true);
            }
        });
    } catch (UnsupportedLookAndFeelException ex) {
        Logger.getLogger(YourClassName.class.getName()).log(Level.SEVERE, null, ex);
    }
}

Old not juicy code (do not copy this dude)老而不多汁的代码(不要复制这个家伙)

public static void main(String args[]) {
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(YourClassName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(YourClassName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(YourClassName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(YourClassName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new YourClassName().setVisible(true);
        }
    });
}

Damn, it works.该死的,它有效。 Now dawg go playin this code, you know what I mean.现在 dawg go 播放这段代码,你知道我的意思。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM