Question:
How do I make a JavaFX Stage resizable? I can create a Stage and drag it around the output window, but can’t grab corners/sides to resize it
Repl link:
https://replit.com/@mprogers/ResizingQuestion
code snippet
public void start(Stage stage) {
Canvas canvas = new Canvas(300, 200);
GraphicsContext gc = canvas.getGraphicsContext2D();
// Draw a rectangle on the canvas
gc.setFill(Color.BLUE);
gc.fillRect(50, 50, 200, 100);
gc.setFill(Color.RED);
gc.setStroke(Color.GREEN);
gc.setLineWidth(2.5);
gc.fillOval(50,50,100,100);
gc.strokeOval(50,50,100,100);
StackPane root = new StackPane(canvas);
Scene scene = new Scene(root, 300, 200);
stage.setScene(scene);
stage.setTitle("Canvas Example");
stage.setResizable(true);
stage.show();
}