经典java小程序源代码合集.zip

上传者: notebookfy | 上传时间: 2021-12-01 08:39:16 | 文件大小: 602KB | 文件类型: -
160个项目开发实例,聊天项目,小游戏适和新手学习(项目采用GBK编码)。
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 int[length][length];
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 JMenuItem[4];
String[] command_str={"囱", "郎", "弄郎", "秨"};

int[][] dir = { {-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1} };
boolean[] dir2 = new boolean[8];

boolean turn;
String message;

final JDialog dialog = new JDialog(this, "叫匡", true);

Font font=new Font("new_font", Font.BOLD, 20);
Grid grids[][] = new Grid[length][length];

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 JRadioButton[2];

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("き囱");

boardPanel = new JPanel();
boardPanel.setLayout(new GridLayout(length, length, 0, 0));
boardPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

for(int i=0; i for(int j=0; j

文件下载

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明