List of usage examples for javafx.scene.layout VBox VBox
public VBox()
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Checkbox Sample"); stage.setWidth(230);//from www . j a v a 2 s . c o m stage.setHeight(120); Path path = new Path(); path.getElements().add(new MoveTo(0.0f, 50.0f)); path.getElements().add(new LineTo(100.0f, 100.0f)); VBox vbox = new VBox(); vbox.getChildren().addAll(path); vbox.setSpacing(5); HBox root = new HBox(); root.getChildren().add(vbox); 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) { ChoiceBox choiceBoxRef = ChoiceBoxBuilder.create().items(cursors).build(); VBox box = new VBox(); box.getChildren().add(choiceBoxRef); final Scene scene = new Scene(box, 300, 250); scene.setFill(null);/*w w w. ja v a2s . co m*/ stage.setScene(scene); stage.show(); scene.cursorProperty().bind(choiceBoxRef.getSelectionModel().selectedItemProperty()); }
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 -> {//from ww w . j a v a 2 s. co m 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) { stage.setTitle("HTML"); stage.setWidth(500);// w ww . ja v a 2 s . co m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); final HTMLEditor htmlEditor = new HTMLEditor(); htmlEditor.setPrefHeight(600); htmlEditor.setHtmlText(INITIAL_TEXT); root.getChildren().addAll(htmlEditor); 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(); msg.setStyle("-fx-text-fill: blue;"); Button sayHelloBtn = new Button("Say Hello"); Button exitBtn = new Button("Exit"); sayHelloBtn.setOnAction(e -> {/* w ww .j av a 2s. 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) { TextField fName = new TextField(); TextField lName = new TextField(); TextField salary = new TextField(); marker = new Circle(5); marker.setManaged(false);/*from w w w . j a v a 2 s. co m*/ 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);//from ww w . j a v a 2 s. co m 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 primaryStage) { primaryStage.setTitle("Simple Search"); TextField txt = new TextField(); txt.setPromptText("Search"); txt.textProperty().addListener(new ChangeListener() { public void changed(ObservableValue observable, Object oldVal, Object newVal) { search((String) oldVal, (String) newVal); }//from w w w . j av a2 s.c om }); list.setMaxHeight(180); for (int i = 0; i < 100; i++) { entries.add("Item " + i); } entries.add("A"); entries.add("B"); entries.add("C"); entries.add("D"); list.setItems(entries); VBox root = new VBox(); root.setPadding(new Insets(10, 10, 10, 10)); root.setSpacing(2); root.getChildren().addAll(txt, list); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { TextArea myTextArea = new TextArea(); VBox hbox = new VBox(); hbox.getChildren().add(myTextArea); VBox.setVgrow(myTextArea, Priority.ALWAYS); Scene scene = new Scene(hbox, 320, 112, Color.rgb(0, 0, 0, 0)); primaryStage.setScene(scene);/*from w w w. j a v a2 s . co m*/ primaryStage.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);/*from w ww .ja va2 s . 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(); }