91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

學習java游戲編程的方法,從一個簡單的棋牌游戲開始,Yeah!

資源截圖

代碼片段和文件信息

package?com;

import?java.awt.Point;
import?java.awt.event.MouseEvent;
import?java.awt.event.MouseListener;

import?javax.swing.ImageIcon;
import?javax.swing.JLabel;

public?class?Card?extends?JLabel?implements?MouseListener{

Main?main;//Main類的引用
String?name;//圖片url名字
boolean?up;//是否正反面
boolean?canClick=false;//是否可被點擊
boolean?clicked=false;//是否點擊過
public?Card(Main?mString?nameboolean?up){
this.main=m;
this.name=name;
this.up=up;
????if(this.up)
???? this.turnFront();
????else?{
this.turnRear();
}
this.setSize(71?96);
this.setVisible(true);
this.addMouseListener(this);
}
//正面
public?void?turnFront()?{
this.setIcon(new?ImageIcon(“images/“?+?name?+?“.gif“));
this.up?=?true;
}
//反面
public?void?turnRear()?{
this.setIcon(new?ImageIcon(“images/rear.gif“));
this.up?=?false;
}
@Override
public?void?mouseClicked(MouseEvent?e)?{
//?TODO?Auto-generated?method?stub
}
public?void?mouseEntered(MouseEvent?arg0)?{}
public?void?mouseExited(MouseEvent?arg0)?{}
public?void?mousePressed(MouseEvent?e)?{
if(canClick)
{
Point?from=this.getLocation();
int?step;?//移動的距離
if(clicked)
step=-20;
else?{
step=20;
}
clicked=!clicked;?//反向
//當被選中的時候,向前移動一步/后退一步
Common.move(thisfromnew?Point(from.xfrom.y-step));
}
}
public?void?mouseReleased(MouseEvent?arg0)?{

}

}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

-----------?---------??----------?-----??----

???????????????323647????????????????????225


評論

共有 條評論