



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
主题:五子棋java程序 信誉要求:无要求悬赏分值:无回复次数:4 最大回复:999当前状态:未结题发表时间:2008-11-09 22:27:58 我这里有五子棋的java程序,有源文件,也有弄好的,有谁要的,来吧就! 我有时间给你传过去,还有一些别的小程序,贪吃蛇什么的 先复一部分吧,也不是很多! 看看吧,一共是800多行,呵呵 import java.util.*; import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; class Gobang extends JFrame implements Runnable, ActionListener final static int Player=1; final static int AI =-1; ClassLoader cl = this.getClass().getClassLoader(); Toolkit tk = Toolkit.getDefaultToolkit(); int length=14, game_state, winner, check, step; int grid = new intlengthlength; int locX, locY , count , x, y, displace_x=0, displace_y=0 , direction; ArrayList steps = new ArrayList(); JPopupMenu control_menu = new JPopupMenu(); JMenuItem command = new JMenuItem4; String command_str=?囱, ?s郎, 弄郎, ?; int dir = -1, -1, -1, 0, -1, 1, 0, -1, 0, 1, 1, -1, 1, 0, 1, 1 ; boolean dir2 = new boolean8; boolean turn; String message; final JDialog dialog = new JDialog(this, 叫匡?l, true); Font font=new Font(new_font, Font.BOLD, 20); Grid grids = new Gridlengthlength; Image white= tk.getImage(cl.getResource(res/white.png); Image black= tk.getImage(cl.getResource(res/black.png); Image title= tk.getImage(cl.getResource(res/title.png); Image temp; JPanel boardPanel, bigpanel; JRadioButton choice = new JRadioButton2; final static int Start =0; final static int Select =1; final static int Playing =2; final static int End =3; final static int nil=-1; final static int oblique_1 =0; final static int oblique_2 =1; final static int horizontal =2; final static int vertical=3; Gobang() super(?l囱); boardPanel = new JPanel(); boardPanel.setLayout(new GridLayout(length, length, 0, 0); boardPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); for(int i=0; ilength; i+) for(int j=0; jlength; j+) gridsij = new Grid(i, j); boardPanel.add(gridsij); bigpanel = new JPanel(); bigpanel.add(boardPanel, BorderLayout.CENTER); getContentPane().add(bigpanel, BorderLayout.SOUTH); game_state=Start; ThreadStart(); dialog.setSize(160, 100); dialog.setResizable(false); dialog.setLocationRelativeTo(null); ButtonGroup choice_group = new ButtonGroup(); JPanel choice_menu = new JPanel(); choice0 = new JRadioButton(堵?l, new ImageIcon(black), true); choice1 = new JRadioButton(?l, new ImageIcon(white); for(int i=0; ichoice.length; i+) choice_menu.add(choicei); choice_group.add(choicei); for(int i=0; icommand.length; i+) commandi =new JMenuItem(command_stri); commandi.addActionListener(this); control_menu.add(commandi); JButton select = new JButton(?T?w); JPanel select_menu = new JPanel(); select_menu.add(select); select.addActionListener(this); dialog.getContentPane().add(choice_menu, BorderLayout.NORTH); dialog.getContentPane().add(select_menu, BorderLayout.CENTER); setIconImage(title); setResizab
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 离婚后共同财产分割与子女生活费用补充协议
- 新能源汽车制造企业股权转让及技术许可合同
- 双方离婚协议书:婚姻终止及财产分配方案
- 离婚协议书:婚姻终止后财产继承权与赠与合同
- 生态休闲农庄土地租赁与生态农业项目推广合同
- 班组技术及安全培训课件
- 瑜伽纤细身形课件
- 辽源公务员专业知识培训课件
- 深圳社保公积金培训
- 科学技术史试题库及答案
- 餐厅迎宾培训内容
- 《中国古代的法治与教化》部优课件1
- 梅毒测试题及答案
- 光伏发电工程竣工最终验收报告
- 以技术驱动的医院管理人才培养路径
- 角膜捐献协议书范本
- 基于数字孪生技术的水泥设备状态监测与预测性维护研究
- 申请律师执业实习试题及答案
- 分布式清洁能源多源互补供热研究现状分析
- 2025年小学生科普知识竞赛练习题库及答案(200题)
- 传统乐器琵琶课件
评论
0/150
提交评论