Set Scene background color and size : Scene « JavaFX « Java

Set Scene background color and size


import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Main extends Application {

    public static void main(String[] args) {
    public void start(Stage primaryStage) {
        final Circle circ = new Circle(40, 40, 30);
        final Group root = new Group(circ);
        final Scene scene = new Scene(root, 800, 400, Color.BEIGE);

        final Text text1 = new Text(25, 25, "");
        text1.setFont(Font.font(java.awt.Font.SERIF, 25));


Related examples in the same category

1.Create Scene from VBox
2.Show a Scene
3.Create and Set size and background color for a Scene
4.Not resizable Window Scene
5.Set CSS file to Scene
6.Binding window Scene size to Title