四人斗地主java程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
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("1分");
btnOne.addActionListener(new
CallPokerDialog_btnOne_actionAdapter(this));
this.getContentPane().setLayout(null);
btnTwo.setBounds(new Rectangle(82, 17, 73, 25));
btnTwo.setText("2分");
btnTwo.addActionListener(new
CallPokerDialog_btnTwo_actionAdapter(this));
btnThree.setBounds(new Rectangle(161, 17, 73, 25));
btnThree.setText("3分");
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) {