Hello everyone,

This is my code. I'm trying to make a random number and then that random number should create a graphic dice. Very basic program, I am just learning this and am about five weeks into classes for it. To keep this short, here's the problem: I can get the dice to appear. But the functions to create the dots don't do anything. I know it isn't added to my dicePane and I'm sure that is why, I don't have the dots set to display. But how can I do that? When I add dot1, dot2, dot3, etc to my dicePane, it doesn't work. I even tried removing the generateOne function and just pasting that code into the switch function to have it built in and it still didn't work. How can I adjust this code to make the dots display? Thanks!

package dicegraphic;
 
import java.util.Random;
import javafx.geometry.Pos;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
 
public class DiceGraphic extends HBox
{
   public DiceGraphic()
   {
      Random generator = new Random();
      int num1;
 
      num1 = generator.nextInt(6) + 1;
      Rectangle diceBorder = new Rectangle(99, 99, 202, 202);
      Rectangle diceOne = new Rectangle(100, 100, 200, 200);
      diceOne.setFill(Color.WHITE);
      diceBorder.setArcHeight(10);
      diceBorder.setArcWidth(10);
      diceOne.setArcHeight(10);
      diceOne.setArcWidth(10);
 
       switch (num1)
       {
           case 1:
               generateOne();
               break;
           case 2:
               generateTwo();
               break;
           case 3:
               generateThree();
               break;
           case 4:
               generateFour();
               break;
           case 5:
               generateFive();
               break;
           case 6:
               generateSix();
               break;
           default:
               break;
       }
 
       StackPane dicePane = new StackPane(diceBorder, diceOne);
       dicePane.setPrefSize(400, 400);
 
       getChildren().addAll(dicePane);
 
   }
 
   public static void generateOne()
   {
       Circle dot = new Circle(150, 150, 5);
       dot.setFill(Color.BLACK);
   }
   public static void generateTwo()
   {
       Circle dot2 = new Circle(120, 120, 5);
       dot2.setFill(Color.BLACK);
       Circle dot3 = new Circle(170, 170, 5);
       dot3.setFill(Color.BLACK);
   }
   public static void generateThree()
   {
       generateTwo();
       Circle dot4 = new Circle(150, 150, 5);
       dot4.setFill(Color.BLACK);
   }
   public static void generateFour()
   {
       generateTwo();
       Circle dot5 = new Circle(120, 170, 5);
       dot5.setFill(Color.BLACK);
       Circle dot6 = new Circle(170, 120, 5);
       dot6.setFill(Color.BLACK);
   }
   public static void generateFive()
   {
       generateThree();
       Circle dot7 = new Circle(120, 170, 5);
       dot7.setFill(Color.BLACK);
       Circle dot8 = new Circle(170, 120, 5);
       dot8.setFill(Color.BLACK);
   }
   public static void generateSix()
   {
       generateFour();
       Circle dot9 = new Circle(120, 150, 5);
       dot9.setFill(Color.BLACK);
       Circle dot10 = new Circle(150, 120, 5);
       dot10.setFill(Color.BLACK);
   }
 
}


--- Update ---

Here is the second file, which it for some reason wouldn't allow me to put in the original post.

package dicegraphic;
 
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.stage.Stage;
***********************************************************************
 
public class Dice extends Application
{
    //--------------------------------------------------------------------
    //  Creates and presents the program window.
    //--------------------------------------------------------------------
    @Override
    public void start(Stage primaryStage)
    {
        DiceGraphic pane = new DiceGraphic();
        pane.setAlignment(Pos.CENTER);
        pane.setStyle("-fx-background-color: red");
 
        Scene scene = new Scene(pane, 400, 400);
 
        primaryStage.setTitle("Graphic Dice");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
 
    public static void main(String[] args)
    {
        launch(args);
    }
}