package mmjj;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import javax.swing.border.Border;
public class MainFrame extends JFrame implements MouseListener, Runnable , ActionListener {
Container main;
Pai da = null; //打出的牌大样
Pai daTemp = null;//打出的牌临时引用
MainPai south = new MainPai();
MainPai east = new MainPai();
MainPai west = new MainPai();
MainPai north = new MainPai();
Thread t,time1, time2, time3;
MouseClick mevent = new MouseClick();
MainFrame me;
boolean isBeiGang, isXiGang, isDongGang;
int sx = 340;//南家出牌位置
int sy = 440;
int ex = 740;//东面出牌的位置
int ey = 480;
int nx = 680;//北面出牌的位置
int ny = 225;
int wx ;//西面出牌的位置
int wy ;
int pengx = 140;
int pengy = 600;
int dongx ;
int dongy ;
int beix ;
int beiy ;
int xix ;
int xiy ;
int num = 0 ;
int money = 1000;
int emoney = 10000; //金钱
int nmoney = 10000;
int wmoney = 10000;
int ecount = 0;//东面出牌数
int wcount = 0;
int ncount = 0;
int scount = 0;
int mo;
int whoWin = 0;//谁糊了0表示南,3表示西
int isWho = 0; //论到哪一家出牌0南,1东,2北,3西
String fangPic = "";//哪家放炮的图片文件名
ArrayList southPai = null;
ArrayList westPai = null;
ArrayList eastPai = null;
ArrayList northPai = null;
ArrayList daGuoPai = null;
ArrayList eKehu = null;
ArrayList wKehu = null;
ArrayList nKehu = null;
ArrayList sKehu = null;
ArrayList allShow ;
ArrayList keGang = null;
ArrayList daoPai;
ArrayList tempShan = null;
ArrayList pais = null;
ArrayList nanPengList;
ArrayList beiPengList;
ArrayList dongPengList;
ArrayList xiPengList;
ArrayList allDa = null;
Pai[] laoPai = null;
int zhuang = -1;
int state = -1; //轮到谁模牌 -1表示未开始,1表示庄家,2,3,4。-2表示东糊,-3表示西糊了,-4,-5
int pengCount = 0;
int gangCount = 0;
boolean isHaidilao;
int laoCount;
boolean isPeng = false;
boolean isGang = false;
boolean yiPeng = false;
boolean dengGang = false;
boolean shan = false;
boolean ePeng = false;
boolean nPeng = false;
boolean wPeng = false;
boolean isOver , isTing, baoTing ;
int eok, nok , wok;
int dongCount = 0; //东面碰牌次数
int beiCount = 0;
int xiCount = 0;
int eGang, nGang, wGang;
int lastCode; //最后自摸或放炮的那张牌号
JButton restart = new JButton();
JButton peng = new JButton();
JButton gang = new JButton();
JButton ting = new JButton();
JButton hu = new JButton();
JButton guo = new JButton();
Cursor hand = new Cursor(Cursor.HAND_CURSOR);
JLabel etxt = new JLabel("貂禅");
JLabel evalue = new JLabel("10000");
JLabel ntxt = new JLabel("杨贵妃 10000");
JLabel wtxt = new JLabel("西施");
JLabel wvalue = new JLabel("10000");
JLabel stxt = new JLabel(" 1000");
ImageIcon icon = null; //按钮图标
Border border = BorderFactory.createLineBorder(Color.ORANGE, 3);
String southName = "";
public void reset(){
da = null;
daTemp = null;
isWho = 0;
t = null;
sx = 340; sy = 440;
southPai = new ArrayList();
northPai = new ArrayList();
westPai = new ArrayList();
eastPai = new ArrayList();
daGuoPai = new ArrayList();
allShow = new ArrayList();
keGang = new ArrayList();
daoPai = new ArrayList();
allDa = new ArrayList();
nanPengList = new ArrayList();beiPengList = new ArrayList();
dongPengList = new ArrayList();xiPengList = new ArrayList();
me = this;
peng.setEnabled(false);
ting.setEnabled(false);
hu.setEnabled(false);
gang.setEnabled(false);
guo.setEnabled(false);
icon = null;
ecount = 0; wcount = 0; ncount = 0; scount = 0;
ex = 740;
ey = 480;
nx = 680;//北面出牌的位置
ny = 225;
wx = 265;
wy = 190;
state = -1;
mo = 0; num = 0 ;
pengx = 140;
pengy = 600;
t = null; time1 = null; time2 = null; time3 = null;
fangPic = "";
pengCount = 0;
gangCount = 0;
isPeng = false;
isGang = false;
yiPeng = false;
ePeng = false;
nPeng = false;
wPeng = false; isOver = false; isTing = false;
eok = 0; nok = 0; wok = 0;
whoWin = -1;
dongx = 875;
dongy = 550;
beix = 800; beiy = 100;
xix = 110; xiy = 140;
eGang = 0; nGang = 0; wGang = 0;
dongCount = 0; //东面碰牌次数
beiCount = 0;
xiCount = 0; laoCount = 0; isHaidilao = false;
laoPai = new Pai[8];
dengGang = false; shan = false;
beiCount = 0; xiCount = 0; baoTing = false;
pais = new ArrayList();
for ( int i = 1; i < 137; i ++ ){
pais.add("" + i);
}
zhuang = (int)(Math.random()*4);
main.removeAll();
jbInit(); main.repaint();
}
public MainFrame(){
main = this.getContentPane();
getContentPane().setLayout(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setTitle("武汉麻将--红中杠口口翻");
main.setBackground(Color.WHITE);
restart.setBounds(700,570,55,25);
hu.setBounds(670,570,30,25);
ting.setBounds(640,570,30,25);
guo.setBounds(610,570,30,25);
gang.setBounds(580,570,30,25);
peng.setBounds(550,570,30,25);
etxt.setBounds(985, 350, 60, 23);
evalue.setBounds(982,370,60, 23);
ntxt.setBounds(480, 10, 85, 23);
wtxt.setBounds(8, 350, 60, 23);
wvalue.setBounds(3,370,60, 23);
stxt.setBounds(480, 680, 120, 23);
icon = new ImageIcon(getClass().getResource("restart.gif"));
restart.setIcon(icon);
icon = new ImageIcon(getClass().getResource("peng.gif"));
peng.setIcon(icon);
icon = new ImageIcon(getClass().getResource("gang.gif"));
gang.setIcon(icon);
icon = new ImageIcon(getClass().getResource("ting.gif"));
ting.setIcon(icon);
icon = new ImageIcon(getClass().getResource("guo.gif"));
guo.setIcon(icon);
icon = new ImageIcon(getClass().getResource("hu.gif"));
hu.setIcon(icon);
restart.setCursor(hand); ting.setCursor(hand);
gang.setCursor(hand); peng.setCursor(hand); hu.setCursor(hand);
restart.setToolTipText("重新开始游戏。");
ting.setToolTipText("报听,让电脑自动摸打牌。");
restart.addKeyListener(new KeyAdapter(){
public void keyPressed(KeyEvent ke){
if ( ke.getKeyCode() == ke.VK_F6){
JOptionPane.showMessageDialog(main,"东碰: " + dongCount + " 杠: "+ eGang
+ "\n北碰: " + beiCount + " 杠: "+ nGang
+ "\n西碰: " + xiCount + " 杠: "+ wGang);
}
}
});
restart.addActionListener(this);peng.addActionListener(this);
gang.addActionListener(this);hu.addActionListener(this);
guo.addActionListener(this); ting.addActionListener(this);
main.add(restart);
main.add(etxt); main.add(ntxt); main.add(wtxt);
main.add(evalue); main.add(wvalue);
}
private void jbInit() {
main.add(restart); main.add(peng); main.add(guo);
main.add(hu); main.add(gang); main.add(ting);
main.add(etxt); main.add(stxt); main.add(ntxt); main.add(wtxt);
main.add(evalue); main.add(wvalue);
int temp = (int
没有合适的资源?快使用搜索试试~ 我知道了~
java 麻将 游戏
共176个文件
gif:163个
java:5个
db:5个
4星 · 超过85%的资源 需积分: 41 178 下载量 2 浏览量
2013-02-06
10:58:53
上传
评论 3
收藏 615KB RAR 举报
温馨提示
java 麻将 游戏
资源详情
资源评论
资源推荐
收起资源包目录
java 麻将 游戏 (176个子文件)
Thumbs.db 301KB
Thumbs.db 86KB
Thumbs.db 80KB
Thumbs.db 68KB
Thumbs.db 67KB
easthu.gif 5KB
westhu.gif 5KB
northhu.gif 5KB
eastzimo.gif 5KB
northzimo.gif 5KB
eastdian.gif 5KB
westzimo.gif 5KB
westdian.gif 5KB
northdian.gif 5KB
select.gif 4KB
southzimo.gif 4KB
zimo.gif 4KB
pengpenghu.gif 4KB
pihu.gif 3KB
liuju.gif 3KB
menqin.gif 3KB
gangshangkaihua.gif 3KB
qinyise.gif 2KB
qiduizi.gif 2KB
18.gif 2KB
18.gif 2KB
18.gif 2KB
18.gif 2KB
16.gif 2KB
16.gif 2KB
16.gif 2KB
16.gif 2KB
haidilao.gif 2KB
8.gif 2KB
8.gif 2KB
8.gif 2KB
6.gif 2KB
8.gif 2KB
17.gif 2KB
6.gif 2KB
9.gif 2KB
9.gif 2KB
17.gif 2KB
17.gif 2KB
5.gif 2KB
9.gif 2KB
33.gif 2KB
5.gif 2KB
17.gif 2KB
5.gif 2KB
5.gif 2KB
6.gif 2KB
9.gif 2KB
15.gif 2KB
33.gif 2KB
33.gif 2KB
6.gif 2KB
15.gif 2KB
10.gif 2KB
10.gif 2KB
33.gif 2KB
15.gif 2KB
7.gif 2KB
7.gif 2KB
14.gif 2KB
15.gif 2KB
14.gif 2KB
14.gif 2KB
10.gif 2KB
7.gif 2KB
7.gif 2KB
10.gif 2KB
22.gif 2KB
23.gif 2KB
22.gif 2KB
23.gif 2KB
14.gif 2KB
1.gif 2KB
22.gif 2KB
12.gif 2KB
29.gif 2KB
12.gif 2KB
29.gif 2KB
restart.gif 2KB
29.gif 2KB
13.gif 2KB
23.gif 2KB
29.gif 2KB
11.gif 2KB
13.gif 2KB
11.gif 2KB
1.gif 2KB
1.gif 2KB
11.gif 2KB
12.gif 2KB
23.gif 2KB
1.gif 2KB
24.gif 2KB
21.gif 2KB
22.gif 2KB
共 176 条
- 1
- 2
X497347200
- 粉丝: 6
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论12