📄 cell.java
字号:
package 小游戏;
import java.awt.Rectangle;
import javax.swing.Icon;
import javax.swing.JButton;
public class Cell extends JButton
{
Cell(Icon icon)
{
super(icon);
setSize(100, 100);
}
public void move(String direction, int sleep) {
if (direction == "UP")
setLocation(getBounds().x, getBounds().y - 100);
else if (direction == "DOWN")
setLocation(getBounds().x, getBounds().y + 100);
else if (direction == "LEFT")
setLocation(getBounds().x - 100, getBounds().y);
else
setLocation(getBounds().x + 100, getBounds().y);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -