private void setLF() {
// Force SwingApp to come up in the System L&F
String laf = UIManager.getSystemLookAndFeelClassName();
try {
// System.out.println("========================"+laf);
UIManager.setLookAndFeel(laf);
} catch (UnsupportedLookAndFeelException exc) {
System.err.println("Warning: UnsupportedLookAndFeel: " + laf);
} catch (Exception exc) {
System.err.println("Error loading " + laf + ": " + exc);
}
}Swing就会调用不同的系统中的UI元素。
本文介绍如何通过代码设置Swing应用程序使用系统的本地外观和感觉(Look and Feel),包括获取系统默认的UI管理器类名,并尝试设置该外观,同时处理可能出现的UnsupportedLookAndFeelException和其他异常。
605

被折叠的 条评论
为什么被折叠?



