五子棋游戏源代码(2)

时间:2025-02-22

【柯哀王道】左右两边的世界-作者:忧冷繁星

public static boolean checkcomputer=true;

private int width,height;

private ChessModel cm;

private MainPanel mp;

//构造五子棋游戏的主窗体

public ChessFrame() {

this.setTitle("五子棋游戏");

cm=new ChessModel(1);

mp=new MainPanel(cm);

Container con=this.getContentPane();

con.add(mp,"Center");

this.setResizable(false);

this.addWindowListener(new ChessWindowEvent());

MapSize(20,15);

JMenuBar mbar = new JMenuBar();

this.setJMenuBar(mbar);

JMenu gameMenu = new JMenu("游戏");

mbar.add(makeMenu(gameMenu, new Object[] {

"开局", "棋盘","模式", null, "退出"

}, this));

JMenu lookMenu =new JMenu("视图");

mbar.add(makeMenu(lookMenu,new Object[] {

"Metal","Motif","Windows"

},this));

JMenu helpMenu = new JMenu("帮助");

mbar.add(makeMenu(helpMenu, new Object[] {

"关于"

}, this));

}

//构造五子棋游戏的主菜单

public JMenu makeMenu(Object parent, Object items[], Object target){ JMenu m = null;

if(parent instanceof JMenu)

m = (JMenu)parent;

else if(parent instanceof String)

m = new JMenu((String)parent);

else

return null;

for(int i = 0; i < items.length; i++)

if(items[i] == null)

m.addSeparator();

else if(items[i] == "棋盘"){

JMenu jm = new JMenu("棋盘");

五子棋游戏源代码(2).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219