【发布时间】:2013-06-20 10:05:47
【问题描述】:
我在下面设置了主类的外观。
基类代码:
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 默认外观。
你能帮帮我吗?
【问题讨论】:
-
仅适用于JOptionPane,其他组件的外观和感觉是否正确
-
是所有其他组件的行为都与主类中的设置外观相同。但 JOPtion 不是?
-
在调用 JOptionPane 之前 是否设置了外观?
-
是的,我也尝试以下方式...尝试 { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception exception) { } int result = JOptionPane.showOptionDialog(panel, message, "", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, formattedOptions, formattedOptions[0]);
-
您能否发布和 [SSCCE](www.sscce.org) 不仅仅是代码片段?
标签: java windows swing look-and-feel