漂亮的JAVA水晶五子棋

来源:百度知道 编辑:UC知道 时间:2024/06/07 07:26:17
请问哪里有下载?要JAR格式的。

import java.awt.*;
import java.awt.event.*;
class ChessPad extends Panel implements MouseListener,ActionListener {
int x = -1, y = -1, chessColor = 1;
Button button = new Button("重新开局");
TextField text_1 = new TextField("请下黑子棋"),
text_2 = new TextField();
ChessPad() {
setSize(440,440);
setLayout(null); setBackground(Color.orange);
addMouseListener(this);
add(button); button.setBounds(10,5,60,26);
button.addActionListener(this);
add(text_1);
text_1.setBounds(90,5,90,24);
add(text_2);
text_2.setBounds(290,5,90,24);
text_1.setEditable(false);
text_2.setEditable(false);
}

public void paint(Graphics g) {
for(int i = 40; i <= 380;i = i+20) {
g.drawLine(40,i,400,i);
}
g.drawLine(40,400,400,400);
for(int j = 40; j <= 380; j = j+20 ) {
g.drawLine(j,40,j,400);
}
g.drawLine(400,40,400,400);