2006年10月24日星期二

JFrame窗口风格跟win一样

在JFrame下,要想JFrame的风格跟用户当前的win主题一样,可以通过以下代码实现,在构造函数里插入

try {
UIManager.setLookAndFeel ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
javax.swing.SwingUtilities.updateComponentTreeUI(this);
} catch(Exception e) {
e.printStackTrace();
}

没有评论: