怎么用java编写出经典窗口 10
2个回答
展开全部
在程序的main函数中写入如下代码即可,前提是必须是windows系统。
try {
UIManager.setLookAndFeel(“com.sun.java.swing.plaf.windows.WindowsLookAndFeel”);//Windows风格
//UIManager.setLookAndFeel(“com.sun.java.swing.plaf.motif.MotifLookAndFeel”) ; //Mac风格
//UIManager.setLookAndFeel(“javax.swing.plaf.metal.MetalLookAndFeel”) ;//Java默认风格
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (InstantiationException ex) {
ex.printStackTrace();
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
}
try {
UIManager.setLookAndFeel(“com.sun.java.swing.plaf.windows.WindowsLookAndFeel”);//Windows风格
//UIManager.setLookAndFeel(“com.sun.java.swing.plaf.motif.MotifLookAndFeel”) ; //Mac风格
//UIManager.setLookAndFeel(“javax.swing.plaf.metal.MetalLookAndFeel”) ;//Java默认风格
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (InstantiationException ex) {
ex.printStackTrace();
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询