JLabel label; //
JButton b1; // 申明写到前面,你是要作为全局变量,MouseDemo1方法外也要访问的对象。
public MouseDemo1(){
JFrame f=new JFrame("MouseDemo");
Container contentPane=f.getContentPane();
contentPane.setLayout(new GridLayout(2,1));
label=new JLabel("qishi",JLabel.CENTER);
b1=new JButton("ok");
JButton b1; // 申明写到前面,你是要作为全局变量,MouseDemo1方法外也要访问的对象。
public MouseDemo1(){
JFrame f=new JFrame("MouseDemo");
Container contentPane=f.getContentPane();
contentPane.setLayout(new GridLayout(2,1));
label=new JLabel("qishi",JLabel.CENTER);
b1=new JButton("ok");
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货