swing不再支持awt里使用的这种用法了,应该这样:
import javax.swing.*;
public class text{
public static void main(String[] args){
JFrame frm=new JFrame();
JButton but=new JButton();
frm.getContentPane().dd(but); //注意是把but加到frm的ContentPane里
frm.pack(); //用于自动调整主件的大小
frm.show();
}
}
import javax.swing.*;
public class text{
public static void main(String[] args){
JFrame frm=new JFrame();
JButton but=new JButton();
frm.getContentPane().dd(but); //注意是把but加到frm的ContentPane里
frm.pack(); //用于自动调整主件的大小
frm.show();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货