Java 课设

来源:百度知道 编辑:UC知道 时间:2024/07/04 06:23:46
帮我编个Java程序 什么程序都可以 最好稍微长点的简单点的 谢谢 急用 最好写出每个语句的意思和作用

简单的五子棋程序
新建一个chess类,其中代码如下
package work;

import java.awt.Color;

public class Chess {
public static final int diamter=30;
private int x;//在网格中的索引,0~15
private int y;//在网格中的索引,0~15
private Color color;
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Chess(int x, int y, Color color) {
super();
this.x = x;
this.y = y;
this.color = color;
}

}
然后在同一个包中新建FirstFrame类。代码如下
package work;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing