Java UI项目外观FlatLaf

问题描述 投票:0回答:1

在Netbeans UI中进行了一些更改之后,我意识到我的项目也改变了外观。我一直在尝试更改项目的外观,但没有成功。这是我输入的用于强制进行更改的代码,但对应用程序UI无效:

package com.mycompany.main;

import com.mycompany.panels.GUIJFrame;
import com.formdev.flatlaf.FlatDarkLaf;
import javax.swing.UIManager;


/**
 *
 * @author myself
 */
public class Main {

    public static void main(String args[]){

        try {
            UIManager.setLookAndFeel(new FlatDarkLaf());
        } catch (Exception e) {
            System.out.println(e);
        }

        GUIJFrame jframe = new GUIJFrame();
        jframe.setTitle("Campus IT Asset Manager");
        jframe.setLocationRelativeTo(null);
        jframe.setVisible(true);
    }
}

Netbeans

Netbeans

Netbeans是否有可能在其他设置中定义应用程序的外观?有趣的是,我运行了[[Eclipse的相同代码,并显示了正确的FlatDarkLaf外观UI]]。因此,Netbeans可能会以某种方式进行干扰...

Eclipse

Eclipse

谢谢,

Fabio

在Netbeans UI中进行了一些更改之后,我意识到我的项目也改变了外观。我一直在尝试更改项目的外观,但没有成功。这是代码...

java netbeans look-and-feel
1个回答
0
投票
我刚刚意识到一个与Main方法具有不同类的类,并且正在考虑其中一个。我将其注释掉,并且上面的代码有效。
© www.soinside.com 2019 - 2024. All rights reserved.