2

我为主要课程设置了以下外观。

基类代码:

 static
{
    try
    {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    }
    catch (Exception exception)
    {
        logger.error("Error setting look and feel!", exception);
    }
}

子类代码:

   int result = JOptionPane.showOptionDialog(panel,
            message,
            "",
            JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE,
            null,
            formattedOptions,
            formattedOptions[0]);

窗口外观没有设置为 JOptionPane 的窗口,而是显示 java 默认外观。

你能帮帮我吗?

4

1 回答 1

0

这很可能与时间有关。尝试使用 vm arg 设置 laf:

-Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
于 2013-07-12T07:21:55.603 回答