用java拼图的代码 java实现拼图小游戏( 七 )


hasAddActionListener=false;
}
}
}
3:
import javax.swing.Icon;
import javax.swing.JButton;
public class Cell extends JButton {
/**
*
*/
private static final long serialVersionUID = 1L;
Cell(Icon icon){//实际为ICON
super(icon);
this.setSize(100,100);
}
public void move(String direction,int sleep){//方格的移动
if(direction=="UP"){
this.setLocation(this.getBounds().x,this.getBounds().y-100);
}else if(direction=="DOWN"){
this.setLocation(this.getBounds().x,this.getBounds().y+100);
}else if(direction=="LEFT"){
this.setLocation(this.getBounds().x-100,this.getBounds().y);
}else{
this.setLocation(this.getBounds().x+100,this.getBounds().y);
}
}
}
【用java拼图的代码 java实现拼图小游戏】用java拼图的代码的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于java实现拼图小游戏、用java拼图的代码的信息别忘了在本站进行查找喔 。