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);
}
}