私はJava初心者で、白いボールが常に画面に表示されるプログラムを作成しようとしています。1 つのボールが次のボールの前に表示されるまでに数秒の休止が必要であり、ボールは画面上のさまざまな場所に表示される必要があります。RandomGenerator を使用して、ボールをさまざまな場所に表示する方法を教えてください。どんな助けでも大歓迎です!
プライベート RandomGenerator rgen = 新しい RandomGenerator();
//~ Constructor ...........................................................
// ----------------------------------------------------------
/**
 * Creates a new BubbleGame object.
 */
public void init()
{
    //call method to create regions
    CreateRegions();
    //add mouse listeners
    addMouseListeners();
    //loop to add bubbles
    while (true)
    {
        //create a filled bubble
        GOval bubble = new GOval (100, 100, 50, 50);
        bubble.setFilled(true);
        bubble.setColor(Color.WHITE);
        //randomly generate coordinates within the field
        int rgen = 
        //add the bubble and pause 
        add(bubble);
        Thread.sleep(3000);
    }
}