嗨,我在 BlueJ 中做一个屏幕保护程序 .. 我做了几个圈子,但需要做一个循环,以便在随机点创建新圈子,尽管我不知道该怎么做.. 这就是我做了多少。
public class ScreenSaver
{
// instance variables - replace the example below with your own
private Circle a;
private Circle b;
private Circle c;
private Circle d;
/**
* Constructor for objects of class ScreenSaver
*/
public ScreenSaver()
{
// initialise instance variables
//x = 0;
}
public void draw()
{
a = new Circle();
a.moveVertical(70);
a.changeSize(70);
a.slowMoveVertical(-100);
a.makeVisible();
b= new Circle();
b.changeColor("red");
b.moveHorizontal(30);
b.makeVisible();
b.slowMoveVertical(-100);
b.slowMoveVertical(100);
}
如何制作循环以便在随机点创建新圆圈?