📄 randommaster.java~16~
字号:
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.*;import java.net.URL;import java.net.URLClassLoader;public class RandomMaster extends JDialog{ GridLayout gridLayout1 = new GridLayout(); JLabel lblOne = new JLabel(); JLabel lblTwo = new JLabel(); JLabel lblThree = new JLabel(); ImageIcon img1,img2,img3; public RandomMaster() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { gridLayout1.setColumns(3); gridLayout1.setHgap(5); gridLayout1.setRows(1); this.setSize(new Dimension(260, 100)); this.setModal(true); this.setResizable(false); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((screenSize.width - 260)/2,(screenSize.height-100)/2); this.getContentPane().setLayout(gridLayout1); this.setTitle("正在随机产生地主,请稍等... "); //随机产生地主 Random r = new Random(); int n = r.nextInt(4); img1 = new ImageIcon(PokerKernal.one.image); img2 = new ImageIcon(PokerKernal.two.image); img3 = new ImageIcon(PokerKernal.three.image); lblOne.setIcon(img1); lblTwo.setIcon(img2); lblThree.setIcon(img3); this.getContentPane().add(lblOne, null); this.getContentPane().add(lblTwo, null); this.getContentPane().add(lblThree, null); switch(n){ case 1: PokerKernal.master = "one"; break; case 2: PokerKernal.master = "two"; break; case 3: PokerKernal.master = "three"; break; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -