public class Chess extends Frame //添加棋盘的窗口。
{ ChessPad chesspad=new ChessPad();
Chess()
{ setSize(600,600);
setVisible(true);
setLayout(null);
Label label=
new Label("单击下棋子,双击吃棋子,右击棋子悔棋",Label.CENTER);
add(label);label.setBounds(70,55,440,26);
label.setBackground(Color.orange);
add(chesspad);chesspad.setBounds(70,90,440,440);
addWindowListener(new WindowAdapter()
{public void windowClosing(WindowEvent e){System.exit(0);}
});
}
public static void main(String args[])
{ Chess chess=new Chess();
}
}
老师提示Chess没有在chess.java哪里定义。
{ ChessPad chesspad=new ChessPad();
Chess()
{ setSize(600,600);
setVisible(true);
setLayout(null);
Label label=
new Label("单击下棋子,双击吃棋子,右击棋子悔棋",Label.CENTER);
add(label);label.setBounds(70,55,440,26);
label.setBackground(Color.orange);
add(chesspad);chesspad.setBounds(70,90,440,440);
addWindowListener(new WindowAdapter()
{public void windowClosing(WindowEvent e){System.exit(0);}
});
}
public static void main(String args[])
{ Chess chess=new Chess();
}
}
老师提示Chess没有在chess.java哪里定义。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货