【柯哀王道】左右两边的世界-作者:忧冷繁星
//构造五子棋游戏的单选按钮式菜单项
public JRadioButtonMenuItem makeRadioButtonMenuItem(
Object item, Object target){
JRadioButtonMenuItem r = null;
if(item instanceof String)
r = new JRadioButtonMenuItem((String)item);
else if(item instanceof JRadioButtonMenuItem)
r = (JRadioButtonMenuItem)item;
else
return null;
if(target instanceof ActionListener)
r.addActionListener((ActionListener)target);
return r;
}
public void MapSize(int w,int h){
setSize(w * 20+50 , h * 20+100 );
if(!ChessFrame.checkcomputer) {
ChessFrame.iscomputer=false;
} else {
ChessFrame.iscomputer=true;
}
mp.setModel(cm);
mp.repaint();
}
public boolean getiscomputer(){
return ChessFrame.iscomputer;
}
public void restart(){
int modeChess = cm.getModeChess();
if(modeChess <= 3 && modeChess >= 1){
cm = new ChessModel(modeChess);
MapSize(cm.getWidth(),cm.getHeight());
}else{
System.out.println("\u81EA\u5B9A\u4E49");
}
}
public void actionPerformed(ActionEvent e){
String arg=e.getActionCommand();
try{
if (arg.equals("Windows"))