四人斗地主java程序 联系客服

发布时间 : 星期一 文章四人斗地主java程序更新完毕开始阅读57a5edd86f1aff00bed51ebf

package poker; /**

*

Title: 斗地主

*

Description:

*

Copyright: Copyright (c) 2004

*

Company:

* @author 李艳生 * @version 1.0 */

import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*;

public class CallPokerDialog extends JDialog{ JButton btnOne = new JButton(); JButton btnTwo = new JButton(); JButton btnThree = new JButton(); JButton btnFour = new JButton(); int score = PokerKernal.score;

public CallPokerDialog() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } }

private void jbInit() throws Exception { this.setSize(new Dimension(330, 80)); //居中显示 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((screenSize.width - 330)/2,(screenSize.height - 80)/2); this.setModal(true); this.setResizable(false); this.setTitle(\请叫牌\ if(score==1){ btnOne.setBackground(Color.pink); }

else if(score==2){ btnOne.setBackground(Color.pink); btnTwo.setBackground(Color.pink); } btnOne.setBounds(new Rectangle(11, 16, 67, 25)); btnOne.setText(\分\ btnOne.addActionListener(new CallPokerDialog_btnOne_actionAdapter(this)); this.getContentPane().setLayout(null); btnTwo.setBounds(new Rectangle(82, 17, 73, 25)); btnTwo.setText(\分\ btnTwo.addActionListener(new CallPokerDialog_btnTwo_actionAdapter(this)); btnThree.setBounds(new Rectangle(161, 17, 73, 25)); btnThree.setText(\分\ btnThree.addActionListener(new CallPokerDialog_btnThree_actionAdapter(this)); btnFour.setBounds(new Rectangle(240, 16, 73, 25)); btnFour.setSelected(false); btnFour.setText(\不要\ btnFour.addActionListener(new CallPokerDialog_btnFour_actionAdapter(this)); this.getContentPane().add(btnOne, null); this.getContentPane().add(btnTwo, null); this.getContentPane().add(btnThree, null); this.getContentPane().add(btnFour, null); }

void btnOne_actionPerformed(ActionEvent e) { if(score<1){ PokerKernal.score = 1; PokerKernal.two.call = 1; this.dispose(); } }

void btnTwo_actionPerformed(ActionEvent e) { if(score<2){ PokerKernal.two.call = 2; PokerKernal.score = 2; this.dispose(); } }

void btnThree_actionPerformed(ActionEvent e) { if(score<3){ PokerKernal.two.call = 3;

PokerKernal.score = 3; this.dispose(); } }

void btnFour_actionPerformed(ActionEvent e) { this.dispose(); } }

class CallPokerDialog_btnOne_actionAdapter implements java.awt.event.ActionListener { CallPokerDialog adaptee;

CallPokerDialog_btnOne_actionAdapter(CallPokerDialog adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.btnOne_actionPerformed(e); } }

class CallPokerDialog_btnTwo_actionAdapter implements java.awt.event.ActionListener { CallPokerDialog adaptee;

CallPokerDialog_btnTwo_actionAdapter(CallPokerDialog adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.btnTwo_actionPerformed(e); } }

class CallPokerDialog_btnThree_actionAdapter implements java.awt.event.ActionListener { CallPokerDialog adaptee;

CallPokerDialog_btnThree_actionAdapter(CallPokerDialog adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.btnThree_actionPerformed(e); } }

class CallPokerDialog_btnFour_actionAdapter implements java.awt.event.ActionListener { CallPokerDialog adaptee;

CallPokerDialog_btnFour_actionAdapter(CallPokerDialog adaptee) { this.adaptee = adaptee; }

public void actionPerformed(ActionEvent e) { adaptee.btnFour_actionPerformed(e); }

}package poker; /**

*

Title: 斗地主

*

Description: 牌类

*

Copyright: Copyright (c) 2004

*

Company:

* @author 李艳生 * @version 1.0 */

import java.awt.*;

import java.awt.image.*;

public class Card { //牌名称 private String name; //牌点数 private int dot; //牌图片 private Image img;

public Card() { name = \ dot = 0; img = null; }

public Card(String name, int dot, Image img) { this.name = name; this.dot = dot; this.img = img; }

public int getDot() { return dot; }