您的位置:首页 > 编程语言 > Java开发

一个无聊的主谓宾游戏

2015-09-07 18:37 369 查看
这算是第一次写那么垃圾的代码吧 ,为了凑够杀千刀的2000行

import java.awt.*;
import java.awt.event.*;

import java.util.Random;

import javax.swing.JButton;
import javax.swing.JFrame;

public class TestGame {
public static void main(String[] args) {
new QGame().produce();
}
}

class QGame extends JFrame {
String personSet[] = new String[];
String place[] = new String[50];
String thing[] = new String[50];

//人物
personSet[0] = "姚明";
personSet[1] = "郭敬明";
personSet[2] = "雷军";
personSet[3] = "韩寒";
personSet[4] = "汪峰";
personSet[5] = "章子怡";
personSet[6] = "许嵩";
personSet[7] = "tfboys";
personSet[8] = "蛤";
personSet[9] = "方舟子";
personSet[10] = "陈冠希";
personSet[11] = "李天一";
personSet[12] = "周永康";
personSet[13] = "牛顿";
personSet[14] = "爱因斯坦";
personSet[15] = "杜兰特";
personSet[16] = "威斯布鲁克";
personSet[17] = "詹姆斯";
personSet[18] = "克里斯保罗";
personSet[19] = "罗玉凤";
personSet[20] = "百元哥";
personSet[21] = "芙蓉姐姐";
personSet[22] = "鸟叔";
personSet[23] = "谢耳朵";
personSet[24] = "樱木花道";
personSet[25] = "流川枫";
personSet[26] = "张杰";
personSet[27] = "谢娜";
personSet[28] = "金馆长";
personSet[29] = "周杰伦";
personSet[30] = "陈赫";
personSet[31] = "黄晓明";
personSet[32] = "AngleBaby";
personSet[33] = "王尼玛";
personSet[34] = "唐马儒";
personSet[35] = "张全蛋";
personSet[36] = "小智";
personSet[37] = "文章";
personSet[38] = "马伊俐";
personSet[39] = "何炅";
personSet[40] = "汪涵";
personSet[41] = "陈浩南";
personSet[42] = "山鸡";
personSet[43] = "张根硕";
personSet[44] = "奶茶";
personSet[45] = "刘强东";
personSet[46] = "范冰冰";
personSet[47] = "李晨";
personSet[48] = "林志颖";
personSet[49] = "杨幂";

//地点
place[0] = "客厅";
place[1] = "厕所";
place[2] = "卧室";
place[3] = "厨房";
place[4] = "阳台";
place[5] = "深夜的马路上";
place[6] = "屋顶";
place[7] = "教堂";
place[8] = "停车场";
place[9] = "地铁站";
place[10] = "地铁上";
place[11] = "火车站的厕所";
place[12] = "高速公路上";
place[13] = "树林里";
place[14] = "火灾现场";
place[15] = "床底下";
place[16] = "车里";
place[17] = "游泳池里面 ";
place[18] = "操场";
place[19] = "山顶上";
place[20] = "网吧包间";
place[21] = "五道口";
place[22] = "天安门";
place[23] = "酒吧";
place[24] = "KTV";
place[25] = "火车上";
place[26] = "潮湿阴暗的地下室";
place[27] = "优衣库的更衣室";
place[28] = "游船上";
place[29] = "宾馆";
place[30] = "废弃的工厂";
place[31] = "郊区的湖边";
place[32] = "希望的田野上";
place[33] = "拖拉机后斗";
place[34] = "大保健的床上";
place[35] = "军火库";
place[36] = "大明湖畔";
place[37] = "长城";
place[38] = "召唤师峡谷";
place[39] = "铜锣湾";
place[40] = "上海滩";
place[41] = "化粪池";
place[42] = "教室";
place[43] = "舞台上";
place[44] = "马背上";
place[45] = "保时捷的引擎盖上";
place[46] = "树底下";
place[47] = "电线杆底下";
place[48] = "热闹的集市上";
place[49] = "海滩上";

//事件
thing[0] = "吃饭";
thing[1] = "睡觉";
thing[2] = "洗澡";
thing[3] = "小便";
thing[4] = "撸管";
thing[5] = "玩手机";
thing[6] = "玩lol";
thing[7] = "刷微博";
thing[8] = "打麻将";
thing[9] = "跳广场舞";
thing[10] = "唱歌";
thing[11] = "写代码";
thing[12] = "背航概";
thing[13] = "看A片";
thing[14] = "练习开挖掘机";
thing[15] = "日狗";
thing[16] = "割腕";
thing[17] = "开演唱会";
thing[18] = "打球";
thing[19] = "修电脑";
thing[20] = "被爆菊";
thing[21] = "吹笛子";
thing[22] = "打电话";
thing[23] = "刷知乎";
thing[24] = "斗地主";
thing[25] = "打牌";
thing[26] = "搓炉石";
thing[27] = "吹牛逼";
thing[28] = "舞刀弄枪";
thing[29] = "看书";
thing[30] = "吃翔";
thing[31] = "打拳";
thing[32] = "看电影";
thing[33] = "吃牛排";
thing[34] = "呕吐";
thing[35] = "割肉";
thing[36] = "练倒立";
thing[37] = "敷面膜";
thing[38] = "抠鼻屎";
thing[39] = "掏耳朵";
thing[40] = "被揍";
thing[41] = "现场装逼";
thing[42] = "喝水";
thing[43] = "和华莱士谈笑风生";
thing[44] = "签收顺丰快递";
thing[45] = "怒打城管";
thing[46] = "装死";
thing[47] = "抓耳挠腮";
thing[48] = "自拍";
thing[49] = "偷看美女裙底";

TextField tf1, tf2, tf3;//用于生成主谓宾
tf1 = new TextField(10);
tf2 = new TextField(10);
tf3 = new TextField(10);

public void produce() {
Random r = new Random();//用于生成随机数
int rn1 = r.nextInt(50);
int rn2 = r.nextInt(50);
int rn3 = r.nextInt(50);

String s1 = person[rn1];
String s2 = place[rn2];
String s3 = thing[rn3];

Label lb = new Label("在");
JButton bt = new JButton("开始恶搞");
bt.addActionListener( new MyMonitor());
setLayout(new FlowLayout());

add(bt);
add(tf1);
add(lb);
add(tf2);
add(tf3);
pack();
setVisible(true);
}

private class MyMonitor implements ActionListener {
public void actionPerformed(ActionEvent e) {
tf1.setText(s1);
tf2.setText(s2);
tf3.setText(s3);
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java string