List of usage examples for javafx.scene.layout VBox VBox
public VBox(Node... children)
From source file:Main.java
@Override public void start(Stage stage) { VBox vbox = new VBox(20); Scene scene = new Scene(vbox, 400, 400); stage.setScene(scene);/*from ww w .ja v a 2s . c o m*/ DatePicker checkInDatePicker = new DatePicker(); vbox.getChildren().add(checkInDatePicker); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { VBox vbox = new VBox(20); Scene scene = new Scene(vbox, 400, 400); stage.setScene(scene);/*from ww w .j av a2 s . c o m*/ DatePicker startDatePicker = new DatePicker(); DatePicker endDatePicker = new DatePicker(); startDatePicker.setValue(LocalDate.now()); endDatePicker.setValue(startDatePicker.getValue().plusDays(1)); vbox.getChildren().add(new Label("Start Date:")); vbox.getChildren().add(startDatePicker); vbox.getChildren().add(new Label("End Date:")); vbox.getChildren().add(endDatePicker); stage.show(); }
From source file:Main.java
@Override public void start(final Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);//from w ww . ja va 2 s . c o m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox vbox = new VBox(8); // spacing = 8 vbox.getChildren().addAll(new Button("Cut"), new Button("Copy"), new Button("Paste")); scene.setRoot(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); // 5 pixels space between child nodes VBox vbox = new VBox(5); // 1 pixel padding between child nodes only vbox.setPadding(new Insets(1)); Rectangle r1 = new Rectangle(10, 10); Rectangle r2 = new Rectangle(20, 100); Rectangle r3 = new Rectangle(50, 20); Rectangle r4 = new Rectangle(20, 50); HBox.setMargin(r1, new Insets(2, 2, 2, 2)); vbox.getChildren().addAll(r1, r2, r3, r4); root.getChildren().add(vbox);//from w w w .j a v a 2 s . c o m primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { VBox vbox = new VBox(20); Scene scene = new Scene(vbox, 400, 400); stage.setScene(scene);//from ww w. j a v a 2 s . com DatePicker startDatePicker = new DatePicker(); DatePicker endDatePicker = new DatePicker(); startDatePicker.setValue(LocalDate.now()); final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker datePicker) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); if (item.isBefore(startDatePicker.getValue().plusDays(1))) { setDisable(true); setStyle("-fx-background-color: #EEEEEE;"); } } }; } }; endDatePicker.setDayCellFactory(dayCellFactory); endDatePicker.setValue(startDatePicker.getValue().plusDays(1)); vbox.getChildren().add(new Label("Start Date:")); vbox.getChildren().add(startDatePicker); vbox.getChildren().add(new Label("End Date:")); vbox.getChildren().add(endDatePicker); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { String pattern = "yyyy-MM-dd"; VBox vbox = new VBox(20); Scene scene = new Scene(vbox, 400, 400); stage.setScene(scene);// w ww . j a v a 2s .c om DatePicker checkInDatePicker = new DatePicker(); StringConverter<LocalDate> converter = new StringConverter<LocalDate>() { DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern); @Override public String toString(LocalDate date) { if (date != null) { return dateFormatter.format(date); } else { return ""; } } @Override public LocalDate fromString(String string) { if (string != null && !string.isEmpty()) { return LocalDate.parse(string, dateFormatter); } else { return null; } } }; checkInDatePicker.setConverter(converter); checkInDatePicker.setPromptText(pattern.toLowerCase()); vbox.getChildren().add(checkInDatePicker); checkInDatePicker.requestFocus(); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { VBox root = new VBox(5); Label textLbl = new Label("Text:"); TextArea text = new TextArea(); text.setPrefRowCount(10);// www.ja va 2s .c o m text.setPrefColumnCount(20); text.setWrapText(true); // Button to print the TextArea node Button printTextBtn = new Button("Print Text"); printTextBtn.setOnAction(e -> print(text)); // Button to print the entire scene Button printSceneBtn = new Button("Print Scene"); printSceneBtn.setOnAction(e -> print(root)); HBox buttonBox = new HBox(5, printTextBtn, printSceneBtn); root.getChildren().addAll(textLbl, text, buttonBox); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Printing Nodes"); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { VBox vbox = new VBox(20); Scene scene = new Scene(vbox, 400, 400); stage.setScene(scene);//from ww w .j a va2 s .c o m final DatePicker startDatePicker = new DatePicker(); DatePicker endDatePicker = new DatePicker(); startDatePicker.setValue(LocalDate.now()); final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker datePicker) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); long p = ChronoUnit.DAYS.between(startDatePicker.getValue(), item); setTooltip(new Tooltip("You're about to stay for " + p + " days")); } }; } }; endDatePicker.setDayCellFactory(dayCellFactory); endDatePicker.setValue(startDatePicker.getValue().plusDays(1)); vbox.getChildren().add(new Label("Start Date:")); vbox.getChildren().add(startDatePicker); vbox.getChildren().add(new Label("End Date:")); vbox.getChildren().add(endDatePicker); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { msgLbl.setPrefWidth(150);//from w ww . j a v a2s . c o m sayHelloBtn.setOnAction(this::sayHello); VBox root = new VBox(10); root.getChildren().addAll(msgLbl, sayHelloBtn); root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;" + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;"); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Hello FXML"); stage.show(); }
From source file:Main.java
@Override public void start(final Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);/*from w ww. j a va2 s .c o m*/ stage.setHeight(500); Scene scene = new Scene(new Group()); VBox vbox = new VBox(8); // spacing = 8 vbox.getChildren().addAll(new Button("Cut"), new Button("Copy"), new Button("Paste")); scene.setRoot(vbox); stage.setScene(scene); stage.show(); }