典型的newb在这里.试图为我的第一个编程课构建所有强大的tic-tac-toe网格.
我一直在尝试从api文档中做到这一点的一切,但到目前为止没有运气.
我认为我最大的问题是不了解如何使用方法和参数,并且是一个完整的新秀,但我会到达那里.
这就是我所拥有的:
import java.awt.Rectangle;
public class TicTacToe {
public static void main (String[] args) {
new Rectangle (0,0,30,30); //create new box
Rectangle box = new Rectangle (0,0,30,30); // tying the box to a variable
box.add (Rectangle 0,0,10,10); /* error box can onot be resolved to a variable*/
}
}
Run Code Online (Sandbox Code Playgroud)
所以我的问题是如何在这个更大的盒子里添加9盒尺寸宽度10高10的盒子?当我添加这些框时,我必须输入新的xy尺寸吗?
感谢您的帮助!
java ×1