如何在Java GUI编程中获得windows native?

时间:2012-07-11 03:25:18

标签: java windows swing user-interface

我是Java编程的新手,想知道是否有可能在Java GUI应用程序中获得Windows本机外观。显然Swing不起作用。

3 个答案:

答案 0 :(得分:66)

使用以下内容:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

阅读UIManagerHow to Set the Look and Feel了解详情。

答案 1 :(得分:12)

试试这个......

语法为:

UIManager.setLookAndFeel(PLAF); (Pluggable Look and Feel)

因此,您必须包含以下3行。

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

SwingUtilities.updateComponentTreeUI(frame);

updateComponentTreeUI(frame);

SwingUtilities.updateComponentTreeUI(frame)用于在更改后刷新帧。

答案 2 :(得分:-3)

试试这段代码:

javax.swing.UIManager.setLookAndFeel("Windows")