java写的打字游戏代码有哪些呢?
import javax。swing。*;
import java。awt。*;
import java。awt。event。*;
//public class Test1 {
// public static void main(String[] args) {
Dazi dazi = new Dazi;
dazi。
setFrame;
public class Dazi implements KeyListener,Runnable{
JFrame jf;// 主框架;
JMenuBar mainBar;
Thread t = null;
JPanel jp1;// 三位数字
JPanel jp5;// 级数线宽面板
JPanel jp6; // 得分的线宽面板
JLabel jtf;// 显示得分信息
JMenu fileMenu;
JMenu helpMenu;
JLabel jl1 = new JLabel;
JLabel jl2 = new JLabel;
JLabel jl3 = new JLabel;
JLabel jl4 = new JLabel;
int x[]={160,220,280,340};
int y[]={20,20,20,20};
String[][] str4 = new String[4][2];
String tempStr= "";
int flagCount = 0;
int score = 0;
int jibie = 10;
boolean startFlag = false;
public String getstring {
int x = (int) (10 * Math。
random);
int y = (int) (10 * Math。random);
int z = (int) (10 * Math。random);
String str = "" + x + y + z;
return str;
public void setFrame {
jf = new JFrame("dz");
jf。
setDefaultCloseOperation(JFrame。EXIT_ON_CLOSE);
jf。setBounds(100, 100, 500, 500);
jf。setLayout(null);
set4Str;
jf。addKeyListener(this);
jf。
setVisible(true);
jp1 = new JPanel;
jl2 = new JLabel;
jl3 = new JLabel;
jl4 = new JLabel;
showMenu; // 设置菜单
showTool; // 设置工具条
showScore;
jf。
setResizable(false);
//xunhuan;
jp1。setBounds(120, 0, 370, 450);
private void set4Str {
String str = getstring;
str4[0][0] = str;
str4[0][1] = "" + 0;
jl1。
setText(str);
str = getstring;
str4[1][0] = str;
str4[1][1] = "" + 0;
jl2。setText(str);
str = getstring;
str4[2][0] = str;
str4[2][1] = "" + 0;
jl3。
setText(str);
str = getstring;
str4[3][0] = str;
str4[3][1] = "" + 0;
jl4。setText(str);