Create Scene from VBox : Scene « JavaFX « Java






Create Scene from VBox

 
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class Main extends Application {

    @Override
    public void start(Stage stage) {
        stage.initStyle(StageStyle.UNDECORATED);
        Text text = new Text("Transparent!");
        text.setFont(new Font(40));
        VBox box = new VBox();
        box.getChildren().add(text);
        final Scene scene = new Scene(box,300, 250);
        scene.setFill(null);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

   
  








Related examples in the same category

1.Show a Scene
2.Create and Set size and background color for 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