Create and Set size and background color for a Scene : Scene « JavaFX « Java

Create and Set size and background color for a Scene


import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
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) {
        primaryStage.setTitle("Drawing Text");
        Group root = new Group();
        Scene scene = new Scene(root, 300, 250, Color.WHITE);
        int x = 100;
        int y = 100;
        int red = 30;
        int green = 40;
        int blue = 50;

        Text text = new Text(x, y, "JavaFX 2.0");

        text.setFill(Color.rgb(red, green, blue, .99));



Related examples in the same category

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