我是Java编程的新手,想知道是否有可能在Java GUI应用程序中获得Windows本机外观。显然Swing不起作用。
答案 0 :(得分:66)
使用以下内容:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
答案 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")