Java五指棋

时间:2018-09-26 14:06:00
【文件属性】:

文件名称:Java五指棋

文件大小:307KB

文件格式:RAR

更新时间:2018-09-26 14:06:00

Java

用Java编写的一个五指棋 import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.net.URL; @SuppressWarnings("serial") public class ChessMap extends JFrame { private ImageIcon map; //棋盘背景位图 private ImageIcon blackchess; //黑子位图 private ImageIcon whitechess; //白子位图 private ChessPanel cp; //棋盘 private JPanel east; private JPanel west; private static final int FINAL_WIDTH = 450; private static final int FINAL_HEIGHT = 500; //以下为下拉菜单 private JMenuBar menubar; private JMenu[] menu={new JMenu("开始"),new JMenu("设置"),new JMenu("帮助")}; private JMenuItem[] menuitem1={new JMenuItem("重新开始"),new JMenuItem("悔棋"),new JMenuItem("退出")}; private JMenuItem[] menuitem2={new JMenuItem("禁手选择"),new JMenuItem("人机博弈"),new JMenuItem("人人对弈")}; private JMenuItem[] menuitem3={new JMenuItem("规则"),new JMenuItem("关于")}; private boolean haveai=true; //人与人下还是人与电脑下,true与电脑下 Mouseclicked mouseclicked=new Mouseclicked(); MouseMoved mousemoved=new MouseMoved(); Menuitemclicked menuclicked=new Menuitemclicked(); //构造函数 public ChessMap(){ //改变系统默认字体 Font font = new Font("Dialog", Font.PLAIN, 12); java.util.Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof javax.swing.plaf.FontUIResource) { UIManager.put(key, font); } } setTitle("五子棋 "); setSize(FINAL_WIDTH,FINAL_HEIGHT); setResizable(false); init(); setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - FINAL_WIDTH / 2, Toolkit.getDefaultToolkit()


【文件预览】:
Five
----src()
--------blackchess.GIF(1KB)
--------win.wav(54KB)
--------ArrComparator.java(461B)
--------ChessMap.java(12KB)
--------put.wav(5KB)
--------ChessPanel.java(25KB)
--------Five.jar(80KB)
--------bg.jpg(17KB)
--------lost.wav(12KB)
--------whitechess.GIF(2KB)
----bin()
--------blackchess.GIF(1KB)
--------ChessMap$MouseMoved.class(863B)
--------ChessPanel.class(15KB)
--------ArrComparator.class(799B)
--------win.wav(54KB)
--------put.wav(5KB)
--------ChessMap$Mouseclicked.class(3KB)
--------ChessMap$Menuitemclicked.class(4KB)
--------Five.jar(80KB)
--------bg.jpg(17KB)
--------lost.wav(12KB)
--------whitechess.GIF(2KB)
--------ChessMap.class(5KB)
----.classpath(301B)
----.settings()
--------org.eclipse.jdt.core.prefs(629B)
----.project(380B)

网友评论