µÚÒ»·¶ÎÄÍø - רҵÎÄÕ·¶ÀýÎĵµ×ÊÁÏ·ÖÏíÆ½Ì¨

»ùÓÚjava¿ª·¢µÄÖ©Öëֽů³ÌÐòÉè¼Æ£¨º¬Ô´Îļþ£©

À´Ô´£ºÓû§·ÖÏí ʱ¼ä£º2025/7/24 3:33:27 ±¾ÎÄÓÉloading ·ÖÏí ÏÂÔØÕâÆªÎĵµÊÖ»ú°æ
˵Ã÷£ºÎÄÕÂÄÚÈݽö¹©Ô¤ÀÀ£¬²¿·ÖÄÚÈÝ¿ÉÄܲ»È«£¬ÐèÒªÍêÕûÎĵµ»òÕßÐèÒª¸´ÖÆÄÚÈÝ£¬ÇëÏÂÔØwordºóʹÓá£ÏÂÔØwordÓÐÎÊÌâÇëÌí¼Ó΢ÐźÅ:xxxxxxx»òQQ£ºxxxxxx ´¦Àí£¨¾¡¿ÉÄܸøÄúÌṩÍêÕûÎĵµ£©£¬¸ÐлÄúµÄÖ§³ÖÓëÁ½⡣

this.pane.setComponentZOrder(cards[c + i], 1);

Point point = new Point(lastPoint);

if (cards[c + i].getCardValue() == 1){

int n = cards[c + i].whichColumnAvailable(point); point.y -= 240;

PKCard card = (PKCard) this.table.get(point); if (card != null && card.isCardCanMove()){

this.haveFinish(n);\\\\ÅжÏֽůÊÇ·ñ¿ÉÒÔ»ØÊÕÒÔ¼°»ØÊÕµÄ×Ü´ÎÊý

} }

x += 101; }

c += 10; }

4.3.4ֽůµÄÒÆ¶¯ÒÔ¼°·ÅÖÃ

´úÂëʵÏÖÈçÏ£º ÓÃÊó±êÍ϶¯Ö½ÅÆ

public void mouseDragged(MouseEvent arg0){ if (canMove){

21

int x = 0; int y = 0;

Point p = arg0.getPoint(); x = p.x - point.x; y = p.y - point.y; this.moving(x, y); } }

·½·¨£º·ÅÖÃֽů

public void setNextCardLocation(Point point){ PKCard card = main.getNextCard(this); if (card != null){

if (point == null){

card.setNextCardLocation(null);

main.table.remove(card.getLocation()); card.setLocation(card.initPoint); main.table.put(card.initPoint, card); } else{

point = new Point(point); point.y += 20;

card.setNextCardLocation(point); point.y -= 20;

main.table.remove(card.getLocation()); card.setLocation(point);

main.table.put(card.getLocation(), card); card.initPoint = card.getLocation(); } } }

4.3.5ÏÔʾµ±Ç°Ö½ÅÆ¿ÉÐеIJÙ×÷£º ´úÂëʵÏÖÈçÏ£º ·µ»ØÖµ£ºvoid

·½·¨£ºÏÔʾ¿ÉÒÆ¶¯µÄ²Ù×÷

public void showEnableOperator(){ int x = 0;

out: while (true){

Point point = null; PKCard card = null; do{

if (point != null){ n++;

22

}

point = this.getLastCardLocation(n); while (point == null){

point = this.getLastCardLocation(++n); if (n == 10) n = 0; x++;

if (x == 10) break out; }

card = (PKCard) this.table.get(point); }

while (!card.isCardCanMove());

while (this.getPreviousCard(card) != null

&& this.getPreviousCard(card).isCardCanMove()){ card = this.getPreviousCard(card); }

if (a == 10){ a = 0; }

for (; a < 10; a++){ if (a != n){

Point p = null; PKCard c = null; do{

if (p != null){ a++; }

p = this.getLastCardLocation(a); int z = 0;

while (p == null){

p = this.getLastCardLocation(++a); if (a == 10) a = 0; if (a == n) a++; z++;

if (z == 10) break out; }

c = (PKCard) this.table.get(p); }

while (!c.isCardCanMove());

if (c.getCardValue() == card.getCardValue() + 1){ card.flashCard(card); try{

Thread.sleep(800); }

catch (InterruptedException e){

23

e.printStackTrace(); }

c.flashCard(c); a++;

if (a == 10){ n++; }

break out; } } } n++;

if (n == 10){ n = 0; }

x++;

if (x == 10){ break out; } } }

4.3.6»ØÊÕֽů£º

´úÂëʵÏÖÈçÏ£º ·µ»ØÖµ£ºvoid

·½·¨£ºÅжÏֽůµÄ°Ú·ÅÊÇ·ñÍê³É

public void haveFinish(int column){

Point point = this.getLastCardLocation(column); PKCard card = (PKCard) this.table.get(point); do{

this.table.remove(point);

card.moveto(new Point(20 + finish * 10, 580)); //½«×é¼þÒÆ¶¯µ½ÈÝÆ÷ÖÐÖ¸¶¨µÄ˳ÐòË÷Òý¡£ pane.setComponentZOrder(card, 1); //½«Ö½ÅÆÐµÄÏà¹ØÐÅÏ¢´æÈëHashtable

this.table.put(card.getLocation(), card);

24

»ùÓÚjava¿ª·¢µÄÖ©Öëֽů³ÌÐòÉè¼Æ£¨º¬Ô´Îļþ£©.doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ£¬·½±ã¸´ÖÆ¡¢±à¼­¡¢ÊղغʹòÓ¡
±¾ÎÄÁ´½Ó£ºhttps://www.diyifanwen.net/c2wbfr8btai7b8vd538ce5nrap1rg1l00xfe_6.html£¨×ªÔØÇë×¢Ã÷ÎÄÕÂÀ´Ô´£©

Ïà¹ØÍÆ¼ö£º

ÈÈÃÅÍÆ¼ö
Copyright © 2012-2023 µÚÒ»·¶ÎÄÍø °æÈ¨ËùÓÐ ÃâÔðÉùÃ÷ | ÁªÏµÎÒÃÇ
ÉùÃ÷ :±¾ÍøÕ¾×ðÖØ²¢±£»¤ÖªÊ¶²úȨ£¬¸ù¾Ý¡¶ÐÅÏ¢ÍøÂç´«²¥È¨±£»¤ÌõÀý¡·£¬Èç¹ûÎÒÃÇ×ªÔØµÄ×÷Æ·ÇÖ·¸ÁËÄúµÄȨÀû,ÇëÔÚÒ»¸öÔÂÄÚ֪ͨÎÒÃÇ£¬ÎÒÃǻἰʱɾ³ý¡£
¿Í·þQQ£ºxxxxxx ÓÊÏ䣺xxxxxx@qq.com
ÓåICP±¸2023013149ºÅ
Top