cell.java

来自「一个简单的拼图游戏源码」· Java 代码 · 共 24 行

JAVA
24
字号
import javax.swing.Icon;
import javax.swing.JButton;
	
public class Cell extends JButton {
	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);
		}
	}
	
}

⌨️ 快捷键说明

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