1 /*
   2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package hello;
  27 
  28 import javafx.application.Application;
  29 import javafx.geometry.Insets;
  30 import javafx.scene.Scene;
  31 import javafx.scene.control.Button;
  32 import javafx.scene.control.Label;
  33 import javafx.scene.control.Separator;
  34 import javafx.scene.control.ToolBar;
  35 import javafx.scene.effect.InnerShadow;
  36 import javafx.scene.layout.BorderPane;
  37 import javafx.scene.layout.FlowPane;
  38 import javafx.scene.paint.Color;
  39 import javafx.scene.shape.Circle;
  40 import javafx.stage.Stage;
  41 
  42 public class HelloBorderPane extends Application {
  43     /**
  44      * @param args the command line arguments
  45      */
  46     public static void main(String[] args) {
  47         Application.launch(args);
  48     }
  49 
  50     @Override public void start(Stage stage) {
  51 
  52         stage.setTitle("Hello BorderPane");
  53 
  54         BorderPane borderpane = new BorderPane();
  55         borderpane.setPadding(new Insets(10,10,10,10));
  56         ToolBar toolbar = new ToolBar();
  57         toolbar.getItems().addAll(new Button("Insert"), new Button("Delete"));
  58         borderpane.setTop(toolbar);
  59 
  60         FlowPane flow = new FlowPane();
  61         flow.setHgap(4);
  62         flow.setVgap(10);
  63         flow.setPrefWrapLength(400);
  64 
  65         InnerShadow shadow = new InnerShadow();
  66         for (int r = 70; r > 3; r -= 4) {
  67             Circle circle = new Circle();
  68             circle.setEffect(shadow);
  69             circle.setRadius(r);
  70             circle.setFill(Color.RED);
  71             flow.getChildren().add(circle);
  72         }
  73 
  74         borderpane.setCenter(flow);
  75 
  76         borderpane.setBottom(new Label("My status is idle right now"));
  77         borderpane.setLeft(new Separator());
  78         borderpane.setRight(new Separator());
  79 
  80         Scene scene = new Scene(borderpane, 500, 500);
  81         stage.setScene(scene);
  82         stage.show();
  83     }
  84 }