package hellofx; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class GUI003b extends Application { @Override public void start(Stage stg1) throws Exception { StackPane pn = new StackPane(); for(int i = 100; i > 0; i--) { Rectangle rect = new Rectangle(0,0,5*i,5*i); switch(i % 3) { case 0: rect.setFill(Color.RED); break; case 1: rect.setFill(Color.GREEN); break; case 2: rect.setFill(Color.BLUE); break; } pn.getChildren().add(rect); } Scene scn = new Scene(pn, 500, 500); stg1.setScene(scn); stg1.show(); } public static void main(String[] args) { Application.launch(args); } }