List of usage examples for javafx.scene.layout VBox getChildren
@Override
public ObservableList<Node> getChildren()
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addCheckOutNotes(final LocalDate date, final VBox box, final List<CheckInOutDetails> checkOutNotes) { if (checkOutNotes.size() > 0) { for (final CheckInOutDetails next : checkOutNotes) { final TextFlow tf = new TextFlow(); final Text t0 = new Text("Room " + next.room); t0.getStyleClass().add("emphasis"); final Text t1 = new Text(" (" + next.bookingOrigin + ")"); tf.getChildren().addAll(t0, t1); if (!StringUtils.isBlank(next.notes)) { final Text t2 = new Text(": " + next.notes); t2.getStyleClass().add("guest-message"); tf.getChildren().add(t2); }//from w w w .ja v a 2 s.com box.getChildren().add(tf); } box.getChildren().add(new Separator()); } }
From source file:Main.java
@Override public void start(Stage stage) { TextField fName = new TextField(); TextField lName = new TextField(); TextField salary = new TextField(); marker = new Circle(5); marker.setManaged(false);//from www . j a va 2s . c om marker.setFill(Color.RED); marker.setMouseTransparent(true); HBox hb1 = new HBox(); HBox hb2 = new HBox(); HBox hb3 = new HBox(); hb1.getChildren().addAll(new Label("First Name:"), fName); hb2.getChildren().addAll(new Label("Last Name:"), lName); hb3.getChildren().addAll(new Label("Salary:"), salary); VBox root = new VBox(); root.getChildren().addAll(hb1, hb2, hb3, marker); Scene scene = new Scene(root); scene.focusOwnerProperty().addListener((prop, oldNode, newNode) -> placeMarker(newNode)); stage.setScene(scene); stage.setTitle(""); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Checkbox Sample"); stage.setWidth(230);/* w w w . j av a 2 s. com*/ stage.setHeight(120); for (int i = 0; i < names.length; i++) { final CheckBox cb = cbs[i] = new CheckBox(names[i]); cb.selectedProperty().addListener(new ChangeListener<Boolean>() { public void changed(ObservableValue ov, Boolean old_val, Boolean new_val) { System.out.println(new_val); } }); } VBox vbox = new VBox(); vbox.getChildren().addAll(cbs); vbox.setSpacing(5); HBox hbox = new HBox(); hbox.setPadding(new Insets(0, 0, 0, 5)); StackPane stack = new StackPane(); stack.getChildren().add(hbox); HBox root = new HBox(); root.getChildren().add(vbox); root.getChildren().add(stack); root.setSpacing(40); root.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);//from ww w .j a v a 2s .c o m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); Hyperlink link = new Hyperlink("www.java2s.com"); root.getChildren().addAll(link); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Label nameLbl = new Label("Enter your name:"); TextField nameFld = new TextField(); Label msg = new Label(); Button sayHelloBtn = new Button("Say Hello"); sayHelloBtn.setOnAction(e -> {/*w w w .ja v a 2s.c om*/ String name = nameFld.getText(); if (name.trim().length() > 0) { msg.setText("Hello " + name); } else { msg.setText("Hello there"); } }); VBox root = new VBox(); root.setSpacing(5); root.getChildren().addAll(nameLbl, nameFld, msg, sayHelloBtn); Scene scene = new Scene(root, 350, 150); stage.setScene(scene); stage.setTitle("hi"); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Label nameLbl = new Label("Enter your name:"); TextField nameFld = new TextField(); Label msg = new Label(); msg.setStyle("-fx-text-fill: blue;"); Button sayHelloBtn = new Button("Say Hello"); Button exitBtn = new Button("Exit"); sayHelloBtn.setOnAction(e -> {//from w w w . ja va2 s. c o m String name = nameFld.getText(); if (name.trim().length() > 0) { msg.setText("Hello " + name); } else { msg.setText("Hello there"); } }); exitBtn.setOnAction(e -> Platform.exit()); VBox root = new VBox(); root.setSpacing(5); root.getChildren().addAll(nameLbl, nameFld, msg, sayHelloBtn, exitBtn); Scene scene = new Scene(root, 350, 150); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(250);/*from w w w . ja v a2 s. co m*/ stage.setHeight(150); final ToggleGroup group = new ToggleGroup(); RadioButton rb1 = new RadioButton("A"); rb1.setToggleGroup(group); rb1.setUserData("A"); RadioButton rb2 = new RadioButton("B"); rb2.setToggleGroup(group); rb2.setUserData("B"); RadioButton rb3 = new RadioButton("C"); rb3.setToggleGroup(group); rb3.setUserData("C"); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) { if (group.getSelectedToggle() != null) { System.out.println(group.getSelectedToggle().getUserData().toString()); } } }); HBox hbox = new HBox(); VBox vbox = new VBox(); vbox.getChildren().add(rb1); vbox.getChildren().add(rb2); vbox.getChildren().add(rb3); vbox.setSpacing(10); hbox.getChildren().add(vbox); hbox.setSpacing(50); hbox.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 300, 150); stage.setScene(scene);/* w w w . j ava2s . c o m*/ stage.setTitle("Progress Controls"); for (int i = 0; i < values.length; i++) { final Label label = labels[i] = new Label(); label.setText("progress:" + values[i]); final ProgressBar pb = pbs[i] = new ProgressBar(); pb.setProgress(values[i]); final ProgressIndicator pin = pins[i] = new ProgressIndicator(); pin.setProgress(values[i]); final HBox hb = hbs[i] = new HBox(); hb.setSpacing(5); hb.setAlignment(Pos.CENTER); hb.getChildren().addAll(label, pb, pin); } final VBox vb = new VBox(); vb.setSpacing(5); vb.getChildren().addAll(hbs); scene.setRoot(vb); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Radio Button Sample"); stage.setWidth(250);/* w w w. j a va2 s . co m*/ stage.setHeight(150); final ToggleGroup group = new ToggleGroup(); RadioButton rb1 = new RadioButton("A"); rb1.setToggleGroup(group); rb1.setUserData("A"); RadioButton rb2 = new RadioButton("B"); rb2.setToggleGroup(group); rb2.setUserData("B"); RadioButton rb3 = new RadioButton("C"); rb3.setToggleGroup(group); rb3.setUserData("C"); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) { if (group.getSelectedToggle() != null) { System.out.println(group.getSelectedToggle().getUserData().toString()); } } }); HBox hbox = new HBox(); VBox vbox = new VBox(); vbox.getChildren().add(rb1); vbox.getChildren().add(rb2); vbox.getChildren().add(rb3); vbox.setSpacing(10); hbox.getChildren().add(vbox); hbox.setSpacing(50); hbox.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(final Stage stage) { stage.setWidth(500);/* w w w .ja v a 2s . c om*/ stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); CategoryAxis lineXAxis = new CategoryAxis(getData()); root.getChildren().addAll(lineXAxis); scene.setRoot(root); stage.setScene(scene); stage.show(); }