要更改';外观和感觉';java swing GUI的应用?

要更改';外观和感觉';java swing GUI的应用?,java,swing,user-interface,look-and-feel,Java,Swing,User Interface,Look And Feel,我刚刚找到了一个很好的外观,我想我的程序外观使用,但我不知道如何整合它。这是我想要的外观: 我设法找到了这个网站,并下载了一个jar文件,该文件已经包含在我的构建路径中。我还发现了我包含的以下代码行: UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); 当我运行它时,我没有得到任何错误,但是它看起来一点也不像图像。我错过了台阶吗?我需要做什么 另一个我担心的问题是,我目前正在mac电脑上工作,但是我希望无论

我刚刚找到了一个很好的外观,我想我的程序外观使用,但我不知道如何整合它。这是我想要的外观:

我设法找到了这个网站,并下载了一个jar文件,该文件已经包含在我的构建路径中。我还发现了我包含的以下代码行:

UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
当我运行它时,我没有得到任何错误,但是它看起来一点也不像图像。我错过了台阶吗?我需要做什么


另一个我担心的问题是,我目前正在mac电脑上工作,但是我希望无论我是在mac电脑上还是在windows上运行我的程序,外观都是一致的。这可能吗?如果是这样的话,请您建议如何做(如果需要任何更改)?

在Java中设置Swing外观将在操作系统之间传递。我总是在创建Swing GUI之前才做过

public static void main(String[] args) {
    try {    
        UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
    } 
    // Probably want to break this into handling the various exceptions that can be thrown.
    catch (Exception e) {
       // handle exception
    }

    // Create Swing GUI and so forth
}

在创建JFrame之前:

// setup the look and feel properties
Properties props = new Properties();

// set your theme
SmartLookAndFeel.setCurrentTheme(props);
// select the Look and Feel
UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");

您在代码中把
UIManager
语句放在哪里了?此外,图像不一定与您所问的问题相关,而是您的代码,您正在将其设置为LAF存在和不存在。对于某些L&F是必需的,请添加代码行
SwingUtilities.updateComponentTreeUI(框架)
after UIManager.setLookAndFeel()@mKorbel是第一个确定根本问题解决方案的好调用。我在我的评论中链接了一个例子来回答这个被接受的答案。谢谢你的帮助——事实证明,问题出在代码的顺序上。在创建GUI组件之前,我需要设置外观。在哪里调用代码行并不重要,只要GUI得到正确更新。有关可以在运行时更改PLAF的GUI的信息,请参阅(用户希望更改PLAF的次数)。
// setup the look and feel properties
Properties props = new Properties();

// set your theme
SmartLookAndFeel.setCurrentTheme(props);
// select the Look and Feel
UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");