List of usage examples for javafx.scene.layout HBox getChildren
@Override
public ObservableList<Node> getChildren()
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); root.getChildren().add(hbox);// w w w . jav a 2 s . c o m primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); root.getChildren().add(hbox);//from w ww .j av a 2 s . c om primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(0.5); Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); root.getChildren().add(hbox);/* w w w.j a v a2 s.co m*/ primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);/*from ww w.j ava2 s.c om*/ root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:account.management.controller.inventory.InsertStockController.java
public void addRow() { ComboBox<Product> select_item = new ComboBox(); select_item.setPromptText("Select Item"); select_item.setPrefWidth(190);//from w w w .j a va 2s . c om select_item.setPrefHeight(25); new AutoCompleteComboBoxListener<>(select_item); select_item.setOnHiding((e) -> { Product a = select_item.getSelectionModel().getSelectedItem(); select_item.setEditable(false); select_item.getSelectionModel().select(a); }); select_item.setOnShowing((e) -> { select_item.setEditable(true); }); TextField qty = new TextField(); qty.setPromptText("Quantity"); qty.setPrefWidth(97); qty.setPrefHeight(25); TextField rate = new TextField(); rate.setPrefWidth(100); rate.setPrefHeight(25); if (this.voucher_type.getSelectionModel().getSelectedItem().equals("Purchase")) { rate.setPromptText("Purchase Rate"); } else { rate.setPromptText("Sell Rate"); } Button del = new Button("Delete"); HBox row = new HBox(); row.getChildren().addAll(select_item, qty, rate, del); row.setSpacing(10); row.setPadding(new Insets(0, 0, 0, 15)); this.conatiner.getChildren().add(row); del.setOnAction((e) -> { this.conatiner.getChildren().remove(row); this.add_row.setDisable(false); calculateTotal(); }); select_item.getItems().addAll(this.products_list); select_item.setOnAction((e) -> { qty.setText("0"); if (this.voucher_type.getSelectionModel().getSelectedItem().equals("Purchase")) { rate.setText(String.valueOf(select_item.getSelectionModel().getSelectedItem().getLast_p_rate())); } else { rate.setText(String.valueOf(select_item.getSelectionModel().getSelectedItem().getLast_s_rate())); } calculateTotal(); }); qty.setOnKeyReleased((e) -> { calculateTotal(); }); rate.setOnKeyReleased((e) -> { calculateTotal(); }); if (this.conatiner.getChildren().size() >= 8) { this.add_row.setDisable(true); return; } }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(8);//space Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);/*from w w w .j a v a2 s . c o m*/ root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:poe.trade.assist.SearchPane.java
public SearchPane(List<Search> searchList) { data = new SimpleListProperty<>(FXCollections.observableArrayList(searchList)); website.setOnAction(e -> SwingUtil.openUrlViaBrowser(website.getText())); setupSearchTable();/*from w w w . j a v a2s .com*/ setupFilterTextField(); info.setWrapText(true); // setupColumns(); setupAddFields(); setupTableClickListener(); addButton.setOnAction((ActionEvent e) -> { data.add(new Search(addName.getText(), addTags.getText(), addURL.getText(), addAuto.isSelected(), "price_in_chaos")); addName.clear(); addTags.clear(); addURL.clear(); addAuto.setSelected(false); }); remButton.setOnAction((ActionEvent e) -> { int index = searchTable.getSelectionModel().getSelectedIndex(); // if (index != -1) { // searchTable.getItems().remove(index); // } searchTable.remove(index); }); final HBox hb = new HBox(3); hb.getChildren().addAll(addAuto, addButton, remButton); final VBox vb = new VBox(3, addName, addTags, addURL, hb); setSpacing(5); setPadding(new Insets(10, 0, 0, 10)); getChildren().addAll(tagFilterField, nameFilterField, showOnlyNew, searchTable, vb, info); VBox.setVgrow(searchTable, Priority.ALWAYS); setMaxWidth(Double.MAX_VALUE); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new HBox(20), 400, 100); HBox box = (HBox) scene.getRoot(); final ColorPicker colorPicker = new ColorPicker(); colorPicker.setValue(Color.RED); final Text text = new Text("Color picker:"); text.setFill(colorPicker.getValue());//from w w w . jav a 2 s .com colorPicker.setOnAction((ActionEvent t) -> { text.setFill(colorPicker.getValue()); }); box.getChildren().addAll(colorPicker, text); stage.setScene(scene); stage.show(); }
From source file:account.management.controller.inventory.InsertStockController.java
public void calculateTotal() { double total = 0; try {/*from w w w .j a v a2s . c om*/ for (int i = 0; i < this.conatiner.getChildren().size(); i++) { HBox row = (HBox) this.conatiner.getChildren().get(i); TextField qty = (TextField) row.getChildren().get(1); TextField rate = (TextField) row.getChildren().get(2); total += Double.parseDouble(rate.getText()) * Float.parseFloat(qty.getText()); } this.total.setText(String.valueOf(total)); } catch (Exception e) { } }
From source file:account.management.controller.expenseVoucherController.java
public void calculateTotal() { float sum = 0; for (int i = 0; i < this.container.getChildren().size(); i++) { HBox row = (HBox) this.container.getChildren().get(i); TextField amount = (TextField) row.getChildren().get(1); if (!amount.getText().equals("")) sum += Float.parseFloat(amount.getText()); }//from w w w . j ava 2s . c o m this.total.setText(String.valueOf(sum)); this.in_word.setText(EnglishNumberToWords.convert((long) sum) + " taka only"); }