怎样把窗口的lookandfeel设置成Metal样式? String laf = "javax.swing.plaf.metal.MetalLookAndFeel";try { UIManager.setLookAndFeel(laf);} catch (Exception e) { } 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 插入到程序界面载入前比如 main() 方法里最前面 import javax.swing.*;import java.awt.*;public class JFrameTest extends JFrame{ public JFrameTest (){ super("这是一个测试程序!"); setBounds(200,200,200,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); show(); } public static void main(String args[]){ try{ /*设置LookAndFeel*/ UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); /*也可以设置为下列的LookAndFeel*/ //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); //UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch(ClassNotFoundException e){ e.printStackTrace(); } catch(InstantiationException e){ e.printStackTrace(); } catch(IllegalAccessException e){ e.printStackTrace(); } catch(UnsupportedLookAndFeelException e){ e.printStackTrace(); } JFrameTest test=new JFrameTest(); }} 静态方法/变量 Eclipse和Netbeans该用哪个呢 请高手帮我看一下这段代码到底有什么问题? 请教文本域如何自动滚屏 用applet实现clock问题???????? 如何添加一条新记录到数据库?? 【讨论】面向接口编程,分不多,但是绝对干货 在javamail中怎样取得邮件夹的大小呀 初学java应该看那些书? 问一个数据库操作问题 smtp协议发送电子邮件出错 在jb9下编译"默认封装"的问题.???值得研究
import java.awt.*;
public class JFrameTest extends JFrame{ public JFrameTest (){
super("这是一个测试程序!");
setBounds(200,200,200,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
show();
}
public static void main(String args[]){
try{
/*设置LookAndFeel*/
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
/*也可以设置为下列的LookAndFeel*/
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(InstantiationException e){
e.printStackTrace();
}
catch(IllegalAccessException e){
e.printStackTrace();
}
catch(UnsupportedLookAndFeelException e){
e.printStackTrace();
}
JFrameTest test=new JFrameTest();
}
}