I am working on an assignment for school and I created the Sierpinski triangle using a GUI, as you click on the window the triangle fills in with pseudorandom colors. Next I am trying to make the window resizable and leaving the image generated centered while the user resizes the window. I am new to JavaFX and have not seen any really helpful info on making a window resizable. Thanks in advance. Here is a portion of my code for reference:
primaryStage.setTitle("Sierpinski Triangle ");
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.show();
}
private Color getRandomColor() {
Random randomGenerator = new Random();
int red = randomGenerator.nextInt(256);
int green = randomGenerator.nextInt(256);
int blue = randomGenerator.nextInt(256);
return Color.rgb(red,green,blue);
}
private Vertex getRandomVertex(){
Random randomGenerator = new Random();
int vertexIndex = randomGenerator.nextInt(cornerVertexArray.length);
return cornerVertexArray[vertexIndex];
}
}