card.java

来自「windows的蜘蛛纸牌游戏源代码」· Java 代码 · 共 57 行

JAVA
57
字号
//Card类申明
package spider.araneid;

import java.awt.*;
public class Card {
	private Pools pool;
	private Image front;
	private Image rear;
	private Image current;
    private String code;
    public Card(String code) {
		this.code = code;
		Toolkit tk = Toolkit.getDefaultToolkit();
		this.front = tk.getImage("images/"+code+".gif");
		this.rear = tk.getImage("images/rear.gif");
		this.turn2rear();
	}

	public void turn() {
		if (this.current==this.front)
			this.current=this.rear;
		else
			this.current=this.front;
	}

	public void turn2rear() {
		this.current=this.rear;
	}

	public void turn2front() {
		this.current=this.front;
	}

	public Image getCurrent() {
		return this.current;
	}

	public Image getFront() {
		return this.front;
	}

	public Image getRear() {
		return this.rear;
	}

	public String getCode() {
		return this.code;
	}

	public void setPool(Pools pool) {
		this.pool=pool;
	}

	public Pools getPool() {
		return this.pool;
	}
}

⌨️ 快捷键说明

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