📄 callpokerdialog.java
字号:
package poker;/** * <p>Title: 斗地主</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @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) { 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); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -