⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 backgroundkeylistener.java

📁 小游戏一个 蜘蛛纸牌
💻 JAVA
字号:
package dujid.araneid;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.Iterator;
import java.util.Stack;

public class BackgroundKeyListener extends KeyAdapter {
	private String pwdturn = "zhouxiaojing";
	private String pwdVictory = "ilovezhouzhou";
	private String current="";
	private Araneid main;

	public BackgroundKeyListener(Araneid main) {
		this.main = main;
	}

	public void keyPressed(KeyEvent evt) {
		char c = evt.getKeyChar();
		this.current+=c;
		if (this.current.equals(this.pwdturn)) {
			Pools[] pool = (Pools[])main.pool;
			for (int i=0;i<pool.length;i++) {
				Stack cards = (Stack)pool[i].getCards();
				Iterator cardlist = (Iterator)cards.iterator();
				while(cardlist.hasNext()) {
					Card card = (Card)cardlist.next();
					card.turn2front();
				}
				pool[i].repaint();
			}
			DealPool dealpool = (DealPool)main.dealpool;
			Stack cards = (Stack)dealpool.cards;
			Iterator cardlist = (Iterator)cards.iterator();
			while(cardlist.hasNext()) {
				Card card = (Card)cardlist.next();
				card.turn2front();
			}
			dealpool.repaint();
			this.current="";
		}
		if (this.current.equals(this.pwdVictory)) {
			AutoRobot robot = new AutoRobot(this.main);
			robot.showVictoriedPanel();
			this.current="";
		}
		if (evt.getKeyCode()==10) {
			this.current="";
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -