/* * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. */ package helloworld; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.stage.StageStyle; import java.util.Random; public class HelloBlinking extends Application { private static final Random rnd = new Random(); private static final int SIZE = 25; @Override public void start(final Stage stage) { Node[] hb = new Node[SIZE]; for (int j = 0; j < hb.length; j++) { Node[] nodes = new Node[SIZE]; for (int i = 0; i < nodes.length; i ++) { Button b = new Button("i"); nodes[i] = b; } hb[j] = new HBox(nodes); } stage.setScene(new Scene(new VBox(hb))); stage.setX(100); stage.setY(100); stage.setWidth(400); stage.setHeight(400); stage.setOnCloseRequest(event -> { shouldExit = true; }); stage.initStyle(StageStyle.UNDECORATED); stage.show(); new Thread(() -> { while (true) { try { Thread.sleep(50); } catch (InterruptedException ex) { } Platform.runLater(() -> { stage.setWidth(100 + rnd.nextInt(1300)); stage.setHeight(100 + rnd.nextInt(800)); }); } }).start(); } /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(args); } }