网上有关“java 五子棋的源代码 以及类 用例 时序”话题很是火热,小编也是针对java 五子棋的源代码 以及类 用例 时序寻找了一些与之相关的一些信息进行分析,如果能碰巧解决你现在面临的问题,希望能够帮助到您。
您好:手机麻将有挂是真的吗这款游戏可以开挂,确实是有挂的,咨询加微信【】很多玩家在这款游戏中打牌都会发现很多用户的牌特别好,总是好牌,而且好像能看到其他人的牌一样。所以很多小伙伴就怀疑这款游戏是不是有挂,实际上这款游戏确实是有挂的
1.手机麻将有挂是真的吗这款游戏可以开挂,确实是有挂的,通过添加客服微信
2.咨询软件加微信【】在"设置DD功能DD微信手麻工具"里.点击"开启".
3.打开工具.在"设置DD新消息提醒"里.前两个选项"设置"和"连接软件"均勾选"开启"(好多人就是这一步忘记做了)
4.打开某一个微信组.点击右上角.往下拉."消息免打扰"选项.勾选"关闭"(也就是要把"群消息的提示保持在开启"的状态.这样才能触系统发底层接口)
import java.io.*;
class goboard
{
public String[][] board;
private static int BOADSIZE=15;
public void initBoard()
{
board=new String[BOADSIZE][BOADSIZE];
for(int i=0;i<BOADSIZE;i++)
{
for(int j=0;j<BOADSIZE;j++)
{
board[i][j]="+";
}
}
}
public void printboard()
{
for(int i=0;i<BOADSIZE;i++)
{
for(int j=0;j<BOADSIZE;j++)
{
System.out.print(board[i][j]);
}
System.out.println();
}
}
}
public class Wuziqi {
public static void main(String[] args) throws Exception
{
goboard gb=new goboard();
gb.initBoard();
gb.printboard();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String inputstr=null;
while((inputstr=br.readLine())!=null)
{
String[] posStrArr=inputstr.split(",");
int xpos=Integer.parseInt(posStrArr[0]);
int ypos=Integer.parseInt(posStrArr[1]);
gb.board[xpos-1][ypos-1]="●";
gb.printboard();
System.out.println("请输入您下棋的坐标,应为X,Y的格式:");
}
}
}
高分悬赏Java程序,急!!!
很sb的电脑五子棋:
import java.io.*;
import java.util.*;
public class Gobang {
// 定义一个二维数组来充当棋盘
private String[][] board;
// 定义棋盘的大小
private static int BOARD_SIZE = 15;
public void initBoard() {
// 初始化棋盘数组
board = new String[BOARD_SIZE][BOARD_SIZE];
// 把每个元素赋为"╋",用于在控制台画出棋盘
for (int i = 0; i < BOARD_SIZE; i++) {
for (int j = 0; j < BOARD_SIZE; j++) {
// windows是一行一行来打印的。坐标值为(行值, 列值)
board[i][j] = "╋";
}
}
}
// 在控制台输出棋盘的方法
public void printBoard() {
// 打印每个数组元素
for (int i = 0; i < BOARD_SIZE; i++) {
for (int j = 0; j < BOARD_SIZE; j++) {
// 打印数组元素后不换行
System.out.print(board[i][j]);
}
// 每打印完一行数组元素后输出一个换行符
System.out.print("\n");
}
}
// 该方法处理电脑下棋:随机生成2个整数,作为电脑下棋的坐标,赋给board数组。
private void compPlay() {
// 构造一个随机数生成器
Random rnd = new Random();
// Random类的nextInt(int n))方法:随机地生成并返回指定范围中的一个 int 值,
// 即:在此随机数生成器序列中 0(包括)和 n(不包括)之间均匀分布的一个int值。
int compXPos = rnd.nextInt(15);
int compYPos = rnd.nextInt(15);
// 保证电脑下的棋的坐标上不能已经有棋子(通过判断对应数组元素只能是"╋"来确定)
while (board[compXPos][compYPos].equals("╋") == false) {
compXPos = rnd.nextInt(15);
compYPos = rnd.nextInt(15);
}
System.out.println(compXPos);
System.out.println(compYPos);
// 把对应的数组元素赋为"○"。
board[compXPos][compYPos] = "○";
}
// 该方法用于判断胜负:进行四次循环扫描,判断横、竖、左斜、右斜是否有5个棋连在一起
private boolean judgeWin() {
// flag表示是否可以断定赢/输
boolean flag = false;
// joinEle:将每一个横/竖/左斜/右斜行中的元素连接起来得到的一个字符串
String joinEle;
// 进行横行扫描
for (int i = 0; i < BOARD_SIZE; i++) {
// 每扫描一行前,将joinEle清空
joinEle = "";
for (int j = 0; j < BOARD_SIZE; j++) {
joinEle += board[i][j];
}
// String类的contains方法:当且仅当该字符串包含指定的字符序列时,返回true。
if (joinEle.contains("●●●●●")) {
System.out.println("您赢啦!");
flag = true;
// 停止往下继续执行,提前返回flag。
// 如果执行了这个return,就直接返回该方法的调用处;
// 不会再执行后面的任何语句,包括最后那个return语句。
// (而break仅仅是完全跳出这个for循环,还会继续执行下面的for循环。)
return flag;
} else if (joinEle.contains("○○○○○")) {
System.out.println("您输啦!");
flag = true;
// 提前返回flag
return flag;
}
}
// 进行竖行扫描
for (int i = 0; i < BOARD_SIZE; i++) {
joinEle = "";
for (int j = 0; j < BOARD_SIZE; j++) {
// 竖行的元素是它们的列值相同
joinEle += board[j][i];
}
if (joinEle.contains("●●●●●")) {
System.out.println("您赢啦!");
flag = true;
return flag;
} else if (joinEle.contains("○○○○○")) {
System.out.println("您输啦!");
flag = true;
return flag;
}
}
// 进行左斜行扫描
for (int i = -(BOARD_SIZE - 2); i < BOARD_SIZE - 1; i++) {
joinEle = "";
for (int j = 0; j < BOARD_SIZE; j++) {
int line = i + j;
// 只截取坐标值没有越界的点
if (line >= 0 && line < 15) {
joinEle += board[j][line];
}
}
if (joinEle.contains("●●●●●")) {
System.out.println("您赢啦!");
flag = true;
return flag;
} else if (joinEle.contains("○○○○○")) {
System.out.println("您输啦!");
flag = true;
return flag;
}
}
// 进行右斜行扫描
for (int i = 1; i < 2 * (BOARD_SIZE - 1); i++) {
joinEle = "";
for (int j = 0; j < BOARD_SIZE; j++) {
int line = i - j;
if (line >= 0 && line < 15) {
joinEle += board[j][line];
}
}
if (joinEle.contains("●●●●●")) {
System.out.println("您赢啦!");
flag = true;
return flag;
} else if (joinEle.contains("○○○○○")) {
System.out.println("您输啦!");
flag = true;
// 最后这个return可省略
}
}
// 确保该方法有返回值(如果上面条件都不满足时)
return flag;
}
public static void main(String[] args) throws Exception, IOException {
Gobang gb = new Gobang();
gb.initBoard();
gb.printBoard();
// BufferedReader类:带缓存的读取器————从字符输入流中读取文本,并缓存字符。可用于高效读取字符、数组和行。
// 最好用它来包装所有其 read() 操作可能开销很高的 Reader(如 FileReader 和 InputStreamReader)。
// 下面构造一个读取器对象。
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// 定义输入字符串
String inputStr = null;
// br.readLine():每当在键盘上输入一行内容按回车,刚输入的内容将被br(读取器对象)读取到。
// BufferedReader类的readLine方法:读取一个文本行。
// 初始状态由于无任何输入,br.readLine()会抛出异常。因而main方法要捕捉异常。
while ((inputStr = br.readLine()) != null) {
// 将用户输入的字符串以逗号(,)作为分隔符,分隔成2个字符串。
// String类的split方法,将会返回一个拆分后的字符串数组。
String[] posStrArr = inputStr.split(",");
// 将2个字符串转换成用户下棋的坐标
int xPos = Integer.parseInt(posStrArr[0]);
int yPos = Integer.parseInt(posStrArr[1]);
// 校验用户下棋坐标的有效性,只能是数字,不能超出棋盘范围
if (xPos > 15 || xPos < 1 || yPos > 15 || yPos < 1) {
System.out.println("您下棋的坐标值应在1到15之间,请重新输入!");
continue;
}
// 保证用户下的棋的坐标上不能已经有棋子(通过判断对应数组元素只能是"╋"来确定)
// String类的equals方法:比较字符串和指定对象是否相等。结果返回true或false。
if (gb.board[xPos - 1][yPos - 1].equals("╋")) {
// 把对应的数组元素赋为"●"。
gb.board[xPos - 1][yPos - 1] = "●";
} else {
System.out.println("您下棋的点已有棋子,请重新输入!");
continue;
}
// 电脑下棋
gb.compPlay();
gb.printBoard();
// 每次下棋后,看是否可以断定赢/输了
if (gb.judgeWin() == false) {
System.out.println("请输入您下棋的坐标,应以x,y的格式:");
} else {
// 完全跳出这个while循环,结束下棋
break;
}
}
}
}
怎么Java实现鼠标点击的五子棋啊 ?各位大侠 帮帮忙
import java.awt.*;
import java.awt.event.*;
//俄罗斯方块类
public class ERS_Block extends frame{
public static boolean isPlay=false;
public static int level=1,score=0;
public static TextField scoreField,levelField;
public static MyTimer timer;
GameCanvas gameScr;
public static void main(String[] argus){
ERS_Block ers = new ERS_Block("俄罗斯方块游戏 V1.0 Author:Vincent");
WindowListener win_listener = new WinListener();
ers.addWindowListener(win_listener);
}
//俄罗斯方块类的构造方法
ERS_Block(String title){
super(title);
setSize(600,480);
setLayout(new GridLayout(1,2));
gameScr = new GameCanvas();
gameScr.addKeyListener(gameScr);
timer = new MyTimer(gameScr);
timer.setDaemon(true);
timer.start();
timer.suspend();
add(gameScr);
Panel rightScr = new Panel();
rightScr.setLayout(new GridLayout(2,1,0,30));
rightScr.setSize(120,500);
add(rightScr);
//右边信息窗体的布局
MyPanel infoScr = new MyPanel();
infoScr.setLayout(new GridLayout(4,1,0,5));
infoScr.setSize(120,300);
rightScr.add(infoScr);
//定义标签和初始值
Label scorep = new Label("分数:",Label.LEFT);
Label levelp = new Label("级数:",Label.LEFT);
Label namep = new Label("姓名:张三",Label.LEFT);
Label nump = new Label("学号:110821332",Label.LEFT);
scoreField = new TextField(8);
levelField = new TextField(8);
scoreField.setEditable(false);
levelField.setEditable(false);
infoScr.add(namep);
infoScr.add(nump);
infoScr.add(scorep);
infoScr.add(scoreField);
infoScr.add(levelp);
infoScr.add(levelField);
scorep.setSize(new Dimension(20,60));
scoreField.setSize(new Dimension(20,60));
levelp.setSize(new Dimension(20,60));
levelField.setSize(new Dimension(20,60));
scoreField.setText("0");
levelField.setText("1");
//右边控制按钮窗体的布局
MyPanel controlScr = new MyPanel();
controlScr.setLayout(new GridLayout(5,1,0,5));
rightScr.add(controlScr);
//定义按钮play
Button play_b = new Button("开始游戏");
play_b.setSize(new Dimension(50,200));
play_b.addActionListener(new Command(Command.button_play,gameScr));
//定义按钮Level UP
Button level_up_b = new Button("提高级数");
level_up_b.setSize(new Dimension(50,200));
level_up_b.addActionListener(new Command(Command.button_levelup,gameScr));
//定义按钮Level Down
Button level_down_b =new Button("降低级数");
level_down_b.setSize(new Dimension(50,200));
level_down_b.addActionListener(new Command(Command.button_leveldown,gameScr));
//定义按钮Level Pause
Button pause_b =new Button("游戏暂停");
pause_b.setSize(new Dimension(50,200));
pause_b.addActionListener(new Command(Command.button_pause,gameScr));
//定义按钮Quit
Button quit_b = new Button("退出游戏");
quit_b.setSize(new Dimension(50,200));
quit_b.addActionListener(new Command(Command.button_quit,gameScr));
controlScr.add(play_b);
controlScr.add(level_up_b);
controlScr.add(level_down_b);
controlScr.add(pause_b);
controlScr.add(quit_b);
setVisible(true);
gameScr.requestFocus();
}
}
//重写MyPanel类,使Panel的四周留空间
class MyPanel extends Panel{
public Insets getInsets(){
return new Insets(30,50,30,50);
}
}
//游戏画布类
class GameCanvas extends Canvas implements KeyListener{
final int unitSize = 30; //小方块边长
int rowNum; //正方格的行数
int columnNum; //正方格的列数
int maxAllowRowNum; //允许有多少行未削
int blockInitRow; //新出现块的起始行坐标
int blockInitCol; //新出现块的起始列坐标
int [][] scrArr; //屏幕数组
Block b; //对方快的引用
//画布类的构造方法
GameCanvas(){
rowNum = 15;
columnNum = 10;
maxAllowRowNum = rowNum - 2;
b = new Block(this);
blockInitRow = rowNum - 1;
blockInitCol = columnNum/2 - 2;
scrArr = new int [32][32];
}
//初始化屏幕,并将屏幕数组清零的方法
void initScr(){
for(int i=0;i<rowNum;i++)
for (int j=0; j<columnNum;j++)
scrArr[i][j]=0;
b.reset();
repaint();
}
//重新刷新画布方法
public void paint(Graphics g){
for(int i = 0; i < rowNum; i++)
for(int j = 0; j < columnNum; j++)
drawUnit(i,j,scrArr[i][j]);
}
//画方块的方法
public void drawUnit(int row,int col,int type){
scrArr[row][col] = type;
Graphics g = getGraphics();
switch(type){ //表示画方快的方法
case 0: g.setColor(Color.black);break; //以背景为颜色画
case 1: g.setColor(Color.blue);break; //画正在下落的方块
case 2: g.setColor(Color.magenta);break; //画已经落下的方法
}
g.fill3DRect(col*unitSize,getSize().height-(row+1)*unitSize,unitSize,unitSize,true);
g.dispose();
}
public Block getBlock(){
return b; //返回block实例的引用
}
//返回屏幕数组中(row,col)位置的属性值
public int getScrArrXY(int row,int col){
if (row < 0 || row >= rowNum || col < 0 || col >= columnNum)
return(-1);
else
return(scrArr[row][col]);
}
//返回新块的初始行坐标方法
public int getInitRow(){
return(blockInitRow); //返回新块的初始行坐标
}
//返回新块的初始列坐标方法
public int getInitCol(){
return(blockInitCol); //返回新块的初始列坐标
}
//满行删除方法
void deleteFullLine(){
int full_line_num = 0;
int k = 0;
for (int i=0;i<rowNum;i++){
boolean isfull = true;
L1:for(int j=0;j<columnNum;j++)
if(scrArr[i][j] == 0){
k++;
isfull = false;
break L1;
}
if(isfull) full_line_num++;
if(k!=0 && k-1!=i && !isfull)
for(int j = 0; j < columnNum; j++){
if (scrArr[i][j] == 0)
drawUnit(k-1,j,0);
else
drawUnit(k-1,j,2);
scrArr[k-1][j] = scrArr[i][j];
}
}
for(int i = k-1 ;i < rowNum; i++){
for(int j = 0; j < columnNum; j++){
drawUnit(i,j,0);
scrArr[i][j]=0;
}
}
ERS_Block.score += full_line_num;
ERS_Block.scoreField.setText(""+ERS_Block.score);
}
//判断游戏是否结束方法
boolean isGameEnd(){
for (int col = 0 ; col <columnNum; col ++){
if(scrArr[maxAllowRowNum][col] !=0)
return true;
}
return false;
}
public void keyTyped(KeyEvent e){
}
public void keyReleased(KeyEvent e){
}
//处理键盘输入的方法
public void keyPressed(KeyEvent e){
if(!ERS_Block.isPlay)
return;
switch(e.getKeyCode()){
case KeyEvent.VK_DOWN:b.fallDown();break;
case KeyEvent.VK_LEFT:b.leftMove();break;
case KeyEvent.VK_RIGHT:b.rightMove();break;
case KeyEvent.VK_SPACE:b.leftTurn();break;
}
}
}
//处理控制类
class Command implements ActionListener{
static final int button_play = 1; //给按钮分配编号
static final int button_levelup = 2;
static final int button_leveldown = 3;
static final int button_quit = 4;
static final int button_pause = 5;
static boolean pause_resume = true;
int curButton; //当前按钮
GameCanvas scr;
//控制按钮类的构造方法
Command(int button,GameCanvas scr){
curButton = button;
this.scr=scr;
}
//按钮执行方法
public void actionPerformed (ActionEvent e){
switch(curButton){
case button_play:if(!ERS_Block.isPlay){
scr.initScr();
ERS_Block.isPlay = true;
ERS_Block.score = 0;
ERS_Block.scoreField.setText("0");
ERS_Block.timer.resume();
}
scr.requestFocus();
break;
case button_levelup:if(ERS_Block.level < 10){
ERS_Block.level++;
ERS_Block.levelField.setText(""+ERS_Block.level);
ERS_Block.score = 0;
ERS_Block.scoreField.setText(""+ERS_Block.score);
}
scr.requestFocus();
break;
case button_leveldown:if(ERS_Block.level > 1){
ERS_Block.level--;
ERS_Block.levelField.setText(""+ERS_Block.level);
ERS_Block.score = 0;
ERS_Block.scoreField.setText(""+ERS_Block.score);
}
scr.requestFocus();
break;
case button_pause:if(pause_resume){
ERS_Block.timer.suspend();
pause_resume = false;
}else{
ERS_Block.timer.resume();
pause_resume = true;
}
scr.requestFocus();
break;
case button_quit:System.exit(0);
}
}
}
//方块类
class Block {
static int[][] pattern = {
{0x0f00,0x4444,0x0f00,0x4444},//用十六进至表示,本行表示长条四种状态
{0x04e0,0x0464,0x00e4,0x04c4},
{0x4620,0x6c00,0x4620,0x6c00},
{0x2640,0xc600,0x2640,0xc600},
{0x6220,0x1700,0x2230,0x0740},
{0x6440,0x0e20,0x44c0,0x8e00},
{0x0660,0x0660,0x0660,0x0660}
};
int blockType; //块的模式号(0-6)
int turnState; //块的翻转状态(0-3)
int blockState; //快的下落状态
int row,col; //块在画布上的坐标
GameCanvas scr;
//块类的构造方法
Block(GameCanvas scr){
this.scr = scr;
blockType = (int)(Math.random() * 1000)%7;
turnState = (int)(Math.random() * 1000)%4;
blockState = 1;
row = scr.getInitRow();
col = scr.getInitCol();
}
//重新初始化块,并显示新块
public void reset(){
blockType = (int)(Math.random() * 1000)%7;
turnState = (int)(Math.random() * 1000)%4;
blockState = 1;
row = scr.getInitRow();
col = scr.getInitCol();
dispBlock(1);
}
//实现“块”翻转的方法
public void leftTurn(){
if(assertValid(blockType,(turnState + 1)%4,row,col)){
dispBlock(0);
turnState = (turnState + 1)%4;
dispBlock(1);
}
}
//实现“块”的左移的方法
public void leftMove(){
if(assertValid(blockType,turnState,row,col-1)){
dispBlock(0);
col--;
dispBlock(1);
}
}
//实现块的右移
public void rightMove(){
if(assertValid(blockType,turnState,row,col+1)){
dispBlock(0);
col++;
dispBlock(1);
}
}
//实现块落下的操作的方法
public boolean fallDown(){
if(blockState == 2)
return(false);
if(assertValid(blockType,turnState,row-1,col)){
dispBlock(0);
row--;
dispBlock(1);
return(true);
}else{
blockState = 2;
dispBlock(2);
return(false);
}
}
//判断是否正确的方法
boolean assertValid(int t,int s,int row,int col){
int k = 0x8000;
for(int i = 0; i < 4; i++){
for(int j = 0; j < 4; j++){
if((int)(pattern[t][s]&k) != 0){
int temp = scr.getScrArrXY(row-i,col+j);
if (temp<0||temp==2)
return false;
}
k = k >> 1;
}
}
return true;
}
//同步显示的方法
public synchronized void dispBlock(int s){
int k = 0x8000;
for (int i = 0; i < 4; i++){
for(int j = 0; j < 4; j++){
if(((int)pattern[blockType][turnState]&k) != 0){
scr.drawUnit(row-i,col+j,s);
}
k=k>>1;
}
}
}
}
//定时线程
class MyTimer extends Thread{
GameCanvas scr;
public MyTimer(GameCanvas scr){
this.scr = scr;
}
public void run(){
while(true){
try{
sleep((10-ERS_Block.level + 1)*100);
}
catch(InterruptedException e){}
if(!scr.getBlock().fallDown()){
scr.deleteFullLine();
if(scr.isGameEnd()){
ERS_Block.isPlay = false;
suspend();
}else
scr.getBlock().reset();
}
}
}
}
class WinListener extends WindowAdapter{
public void windowClosing (WindowEvent l){
System.exit(0);
}
}
import java.awt.*;
import java.awt.event.*;
import java.awt.color.*;
class wuzi {
public static void main(String[] args) {
frame myframe =new frame("五子棋");
}
}
class frame extends frame implements ActionListener{
MenuBar mbar=new MenuBar();
Menu mgame=new Menu("选项");
Menu mhelp=new Menu("帮助");
MenuItem mstart=new MenuItem("开始 ");
MenuItem mclose=new MenuItem("结束");
MenuItem mabout=new MenuItem("关于");
myCanvas canvas;
frame(String t) {
super(t);
canvas = new myCanvas(this);
mgame.add(mstart);
mgame.add(mclose);
mhelp.add(mabout);
mgame.addActionListener(this);
mstart.addActionListener(this);
mclose.addActionListener(this);
mhelp.addActionListener(this);
mabout.addActionListener(this);
mbar.add(mgame);
mbar.add(mhelp);
this.setMenuBar(mbar);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
);
this.add(canvas);
this.pack();
this.show();
this.setLocation(380,100);
this.setResizable(false);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==mstart)
{
repaint();
}
else if(e.getSource()==mclose){
this.dispose();
System.exit(0);
}
if(e.getSource()==mabout){
about frm=new about();
}
pack();
}
}
class chessman{
private boolean isExist;
private boolean isColor;
public chessman(boolean isExist){
this.isExist = isExist ;
}
boolean getChessExist() {
return isExist;
}
boolean getChessColor() {
return isColor;
}
void setChessExist(boolean m){
isExist = m;
}
void setChessColor(boolean m) { //设置棋的颜色
isColor = m;
}
}
class myCanvas extends Canvas implements MouseListener {
frame myframe;
//保存棋子
private chessman chessMan[][] = new chessman[19][19];
int mx,my;//获取位置
int x,y;
boolean state = true;
myCanvas(frame myframe) {
this.myframe = myframe;
setBackground(Color.cyan);
addMouseListener(this);
for(int i=0;i<19;i++)
for(int j=0;j<19;j++)
chessMan[i][j] = new chessman(false);
}
public void start() {
for(int i=0;i<19;i++)
for(int j=0;j<19;j++)
chessMan[i][j].setChessExist(false);
}
public void paint(Graphics g) {//画线
Dimension size = this.getSize();
g.drawRect(0,0,size.width-1,size.height-1);
g.draw3DRect(1,1,size.width-3,size.height-3,true);
for(int i=0;i<19;i++)
g.drawLine(30,i*24+30,462,i*24+30);
for(int j=0;j<19;j++)
g.drawLine(j*24+30,30,j*24+30,462);
x=(int)((mx-20)/24);
y=(int)((my-20)/24); //计算落子位置
if(!chessMan[y][x].getChessExist()&&(mx>=18||my>=18)){
chessMan[y][x].setChessExist(true);
chessMan[y][x].setChessColor(state);
state = !state;
}
for(int i =0;i<19;i++)
for(int j=0;j<19;j++){
if(chessMan[i][j].getChessExist())
{
if(chessMan[i][j].getChessColor()==true){
g.setColor(Color.black); //默认黑棋先下
}
else{
g.setColor(Color.white);
}
g.fillOval(j*24+21,i*24+21,18,18);
// whowin(x, y) ;
}
}
}
public Dimension getPreferredSize() {
return new Dimension(492,492); //返回图形大小
}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseClicked(MouseEvent e){
mx = e.getX();
my = e.getY();
repaint();
}
}
class about extends frame implements WindowListener //设置关于
{
about() {
this.setSize(300,170);
this.setTitle("关于五子棋游戏");
this.addWindowListener(this);
this.setVisible(true);
this.setLocation(400,200);
this.setResizable(false);
this.setLayout(new FlowLayout());
Label text1 =new Label();
Label text2 =new Label();
Label text3=new Label();
text1.setText("游戏介绍:");
text1.setFont(new Font("黑体",Font.ITALIC,25));
text1.setAlignment(text1.CENTER);
text1.setVisible(true);
text2.setText("横排,竖排,斜排,谁先放到5个就赢。");
text2.setFont(new Font("黑体",Font.PLAIN,15));
text2.setAlignment(text1.LEFT);
text2.setVisible(true);
text3.setText("制作者:0957207吴君");
text3.setFont(new Font("楷体",Font.PLAIN,15));
text3.setVisible(true);
this.add(text1,"North");
this.add(text2,"West");
this.add(text3,"South");
this.show(true);
}
public void windowActivated(WindowEvent e){}
public void windowClosed(WindowEvent e){
}
public void windowClosing(WindowEvent e){
this.dispose();
}
public void windowDeactivated(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowOpened(WindowEvent e) {}
}
关于“java 五子棋的源代码 以及类 用例 时序”这个话题的介绍,今天小编就给大家分享完了,如果对你有所帮助请保持对本站的关注!