List of usage examples for javafx.scene.layout HBox getChildren
@Override
public ObservableList<Node> getChildren()
From source file:account.management.controller.POVoucherController.java
public void addNewRow() { TextField sl = new TextField(); sl.setPromptText("SL"); sl.setPrefWidth(54);/*from w ww.j av a 2 s.c om*/ sl.setEditable(false); TextField desc = new TextField(); desc.setPromptText("Description"); desc.setPrefWidth(216); TextField qty = new TextField(); qty.setPromptText("Quantity"); qty.setPrefWidth(62); qty.setOnKeyReleased((e) -> { calculate(); }); TextField rate = new TextField(); rate.setPromptText("Rate"); rate.setPrefWidth(72); rate.setOnKeyReleased((e) -> { calculate(); }); TextField total = new TextField(); total.setPromptText("Total"); total.setPrefWidth(80); total.setEditable(false); TextField commision = new TextField(); commision.setPromptText("Commision %"); commision.setPrefWidth(90); commision.setOnKeyReleased((e) -> { calculate(); }); TextField total_commision = new TextField(); total_commision.setPromptText("Total Commision"); total_commision.setPrefWidth(132); total_commision.setEditable(false); TextField neat_total = new TextField(); neat_total.setPromptText("Neat Amount"); neat_total.setPrefWidth(115); neat_total.setEditable(false); Button delete = new Button("Delete"); HBox row = new HBox(); row.setSpacing(10); row.getChildren().addAll(sl, desc, qty, rate, total, commision, total_commision, neat_total, delete); delete.setOnAction((e) -> { this.container.getChildren().remove(row); calculate(); }); this.container.getChildren().add(row); calculate(); }
From source file:account.management.controller.POVoucherController.java
public void calculate() { int len = this.container.getChildren().size(); double total_amount = 0; for (int i = 0; i < len; i++) { HBox row = (HBox) this.container.getChildren().get(i); TextField sl_t = (TextField) row.getChildren().get(0); TextField qty_t = (TextField) row.getChildren().get(2); TextField rate_t = (TextField) row.getChildren().get(3); TextField total_t = (TextField) row.getChildren().get(4); TextField commision_t = (TextField) row.getChildren().get(5); TextField total_commision_t = (TextField) row.getChildren().get(6); TextField neat_amount_t = (TextField) row.getChildren().get(7); sl_t.setText(String.valueOf(i + 1)); double qty = qty_t.getText().isEmpty() ? 0 : Double.parseDouble(qty_t.getText()); double rate = rate_t.getText().isEmpty() ? 0 : Double.parseDouble(rate_t.getText()); double total = total_t.getText().isEmpty() ? 0 : Double.parseDouble(total_t.getText()); double commision = commision_t.getText().isEmpty() ? 0 : Double.parseDouble(commision_t.getText()); double total_commision = total_commision_t.getText().isEmpty() ? 0 : Double.parseDouble(total_commision_t.getText()); double neat_amount = neat_amount_t.getText().isEmpty() ? 0 : Double.parseDouble(neat_amount_t.getText()); total = qty * rate;/*w w w . jav a2 s. co m*/ total_commision = total * commision / 100; neat_amount = total - total_commision; total_t.setText(String.valueOf(total)); total_commision_t.setText(String.valueOf(total_commision)); neat_amount_t.setText(String.valueOf(neat_amount)); total_amount += neat_amount; } this.total_price.setText(String.valueOf(total_amount)); }
From source file:com.panemu.tiwulfx.form.BaseControl.java
private PopupControl getPopup() { if (popup == null) { errorLabel = new Label(); errorLabel.textProperty().bind(getErrorMessage()); popup = new PopupControl(); final HBox pnl = new HBox(); pnl.getChildren().add(errorLabel); pnl.getStyleClass().add("error-popup"); popup.setSkin(new Skin() { @Override//w w w . j a va 2 s . c om public Skinnable getSkinnable() { return BaseControl.this.getInputComponent(); } @Override public Node getNode() { return pnl; } @Override public void dispose() { } }); popup.setHideOnEscape(true); } return popup; }
From source file:com.panemu.tiwulfx.form.BaseListControl.java
private PopupControl getPopup() { if (popup == null) { errorLabel = new Label(); errorLabel.textProperty().bind(getErrorMessage()); popup = new PopupControl(); final HBox pnl = new HBox(); pnl.getChildren().add(errorLabel); pnl.getStyleClass().add("error-popup"); popup.setSkin(new Skin() { @Override//from w ww .j a v a2 s . com public Skinnable getSkinnable() { return null;//BaseTableFormControl.this.getInputComponent(); } @Override public Node getNode() { return pnl; } @Override public void dispose() { } }); popup.setHideOnEscape(true); } return popup; }
From source file:org.pdfsam.ui.news.News.java
News(NewsData data) { this.getStyleClass().add("news-box"); TextFlow flow = new TextFlow(); if (data.isImportant()) { Text megaphone = GlyphsDude.createIcon(FontAwesomeIcon.BULLHORN, "1.2em"); megaphone.getStyleClass().clear(); megaphone.getStyleClass().add("news-box-title-important"); flow.getChildren().addAll(megaphone, new Text(" ")); }//from w w w. ja v a 2s.c om Text titleText = new Text(data.getTitle() + System.lineSeparator()); titleText.setOnMouseClicked(e -> eventStudio().broadcast(new OpenUrlRequest(data.getLink()))); titleText.getStyleClass().add("news-box-title"); Text contentText = new Text(data.getContent()); contentText.setTextAlignment(TextAlignment.JUSTIFY); contentText.getStyleClass().add("news-content"); flow.getChildren().addAll(titleText, contentText); flow.setTextAlignment(TextAlignment.JUSTIFY); Label labelDate = new Label(FORMATTER.format(data.getDate()), GlyphsDude.createIcon(MaterialDesignIcon.CLOCK)); labelDate.setPrefWidth(Integer.MAX_VALUE); HBox.setHgrow(labelDate, Priority.ALWAYS); HBox bottom = new HBox(labelDate); bottom.setAlignment(Pos.CENTER_LEFT); bottom.getStyleClass().add("news-box-footer"); if (isNotBlank(data.getLink())) { Button link = UrlButton.urlButton(null, data.getLink(), FontAwesomeIcon.EXTERNAL_LINK_SQUARE, "pdfsam-toolbar-button"); bottom.getChildren().add(link); } getChildren().addAll(flow, bottom); }
From source file:org.jacp.demo.components.ContactAddDialog.java
private void createAddContactDialog() { final VBox box = new VBox(); box.getStyleClass().add("jacp-option-pane"); box.setMaxSize(300, Region.USE_PREF_SIZE); // the title/* www. ja va 2 s . c o m*/ final Label title = new Label("Add new category"); title.setId(GlobalConstants.CSSConstants.ID_JACP_CUSTOM_TITLE); VBox.setMargin(title, new Insets(2, 2, 10, 2)); final HBox hboxInput = new HBox(); final Label nameLabel = new Label("category name:"); HBox.setMargin(nameLabel, new Insets(2)); final TextField nameInput = new TextField(); HBox.setMargin(nameInput, new Insets(0, 0, 0, 5)); HBox.setHgrow(nameInput, Priority.ALWAYS); hboxInput.getChildren().addAll(nameLabel, nameInput); final HBox hboxButtons = new HBox(); hboxButtons.setAlignment(Pos.CENTER_RIGHT); final Button ok = new Button("OK"); HBox.setMargin(ok, new Insets(6, 5, 4, 2)); final Button cancel = new Button("Cancel"); HBox.setMargin(cancel, new Insets(6, 2, 4, 5)); cancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent arg0) { JACPModalDialog.getInstance().hideModalDialog(); } }); ok.setDefaultButton(true); ok.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { final String catName = nameInput.getText(); if (catName != null && StringUtils.hasText(catName)) { // contacts final Contact contact = new Contact(); contact.setFirstName(catName); parent.getContext().send(contact); JACPModalDialog.getInstance().hideModalDialog(); } } }); hboxButtons.getChildren().addAll(ok, cancel); box.getChildren().addAll(title, hboxInput, hboxButtons); JACPModalDialog.getInstance().showModalDialog(box); }
From source file:account.management.controller.POVoucherController.java
@FXML private void onSubmitButtonClick(ActionEvent event) throws ParseException { try {//from w w w .j av a2 s .co m JSONArray array = new JSONArray(); int len = this.container.getChildren().size(); for (int i = 0; i < len; i++) { HBox row = (HBox) this.container.getChildren().get(i); TextField sl_t = (TextField) row.getChildren().get(0); TextField desc_t = (TextField) row.getChildren().get(1); TextField qty_t = (TextField) row.getChildren().get(2); TextField rate_t = (TextField) row.getChildren().get(3); TextField total_t = (TextField) row.getChildren().get(4); TextField commision_t = (TextField) row.getChildren().get(5); TextField total_commision_t = (TextField) row.getChildren().get(6); TextField neat_amount_t = (TextField) row.getChildren().get(7); JSONObject obj = new JSONObject(); obj.put("sl", sl_t.getText()); obj.put("desc", desc_t.getText()); obj.put("qty", qty_t.getText()); obj.put("rate", rate_t.getText()); obj.put("total", total_t.getText()); obj.put("commision", commision_t.getText()); obj.put("total_commision", total_commision_t.getText()); obj.put("neat_amount", neat_amount_t.getText()); array.put(obj); } JSONArray res = Unirest.get(MetaData.baseUrl + "add/purchase/order") .queryString("name", this.name.getText()).queryString("address", this.address.getText()) .queryString("date", this.date.getValue().toString()) .queryString("total_price", this.total_price.getText()) .queryString("shabek", this.opening.getText()) .queryString("grand_total", this.grand_total.getText()) .queryString("tt_dd_cash", this.cash.getText()).queryString("jer", this.balance.getText()) .queryString("content", array).asJson().getBody().getArray(); JSONObject obj = res.getJSONObject(0); if (obj.getString("Status").equals("Success")) { String voucher_no = Unirest.get(MetaData.baseUrl + "purchase/order/lastId").asString().getBody(); Msg.showInformation("Success"); showReport(voucher_no, this.name.getText(), this.address.getText(), this.date.getValue().toString(), array.toString(), this.total_price.getText(), this.opening.getText(), this.grand_total.getText(), this.cash.getText(), this.balance.getText()); } else { Msg.showError(obj.getString("Message")); } } catch (UnirestException ex) { Logger.getLogger(POVoucherController.class.getName()).log(Level.SEVERE, null, ex); Msg.showError(""); } }
From source file:account.management.controller.SellVoucherController.java
@FXML private void onSubmitButtonClick(ActionEvent event) throws ParseException { try {/*from w w w . ja v a 2 s . co m*/ JSONArray array = new JSONArray(); int len = this.container.getChildren().size(); for (int i = 0; i < len; i++) { HBox row = (HBox) this.container.getChildren().get(i); TextField sl_t = (TextField) row.getChildren().get(0); TextField desc_t = (TextField) row.getChildren().get(1); TextField qty_t = (TextField) row.getChildren().get(2); TextField rate_t = (TextField) row.getChildren().get(3); TextField total_t = (TextField) row.getChildren().get(4); TextField commision_t = (TextField) row.getChildren().get(5); TextField total_commision_t = (TextField) row.getChildren().get(6); TextField neat_amount_t = (TextField) row.getChildren().get(7); JSONObject obj = new JSONObject(); obj.put("sl", sl_t.getText()); obj.put("desc", desc_t.getText()); obj.put("qty", qty_t.getText()); obj.put("rate", rate_t.getText()); obj.put("total", total_t.getText()); obj.put("commision", commision_t.getText()); obj.put("total_commision", total_commision_t.getText()); obj.put("neat_amount", neat_amount_t.getText()); array.put(obj); } JSONArray res = Unirest.get(MetaData.baseUrl + "add/sell/order") .queryString("name", this.name.getText()).queryString("address", this.address.getText()) .queryString("date", this.date.getValue().toString()) .queryString("total_price", this.total_price.getText()) .queryString("shabek", this.opening.getText()) .queryString("grand_total", this.grand_total.getText()) .queryString("tt_dd_cash", this.cash.getText()).queryString("jer", this.balance.getText()) .queryString("content", array).asJson().getBody().getArray(); JSONObject obj = res.getJSONObject(0); if (obj.getString("Status").equals("Success")) { String voucher_no = Unirest.get(MetaData.baseUrl + "sell/order/lastId").asString().getBody(); Msg.showInformation("Success"); showReport(voucher_no, this.name.getText(), this.address.getText(), this.date.getValue().toString(), array.toString(), this.total_price.getText(), this.opening.getText(), this.grand_total.getText(), this.cash.getText(), this.balance.getText()); } else { Msg.showError(obj.getString("Message")); } } catch (UnirestException ex) { Logger.getLogger(POVoucherController.class.getName()).log(Level.SEVERE, null, ex); Msg.showError(""); } }
From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java
public void clear() { List<HBox> toDelete = new ArrayList<>(); for (Node node : vboxRadios.getChildren()) { HBox hbox = (HBox) node; boolean delete = false; for (Node hNode : hbox.getChildren()) { if (hNode instanceof CheckBox) { CheckBox chk = (CheckBox) hNode; chk.setSelected(false);/*from w ww . j a v a2s.com*/ delete = chk.getId().startsWith("external"); } } if (delete) { toDelete.add(hbox); } } vboxRadios.getChildren().removeAll(toDelete); }
From source file:fruitproject.FruitProject.java
public void first(final Stage primaryStage) { GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER);/* w w w . j a va2s . c om*/ grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); rows = 0; addPairs.clear(); Text lb = new Text(); lb.setText("J-Fruit"); //lb.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(lb, 1, 0); final ToggleGroup grp = new ToggleGroup(); RadioButton rb1 = new RadioButton(); rb1.setText("Add Fruit file"); rb1.setUserData("add"); rb1.setToggleGroup(grp); rb1.setSelected(true); grid.add(rb1, 1, 1); RadioButton rb2 = new RadioButton(); rb2.setText("Load Fruit file"); rb2.setUserData("load"); rb2.setToggleGroup(grp); grid.add(rb2, 1, 2); Label label1 = new Label("Enter File Name:"); final TextField tfFilename = new TextField(); final HBox hb = new HBox(); hb.getChildren().addAll(label1, tfFilename); hb.setSpacing(10); hb.setVisible(false); tfFilename.setText(""); grid.add(hb, 1, 3); grp.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) { if (grp.getSelectedToggle() != null) { // System.out.println(grp.getSelectedToggle().getUserData().toString()); if (grp.getSelectedToggle().getUserData().toString() == "load") hb.setVisible(true); else { hb.setVisible(false); tfFilename.setText(""); } } } }); if (rb2.isSelected() == true) { hb.setVisible(true); } Button btn = new Button(); btn.setText("GO"); grid.add(btn, 1, 4); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //System.out.println("Hello World!"); if (tfFilename.getText() == "") second(""); else second(tfFilename.getText()); primaryStage.close(); } }); //StackPane root = new StackPane(); //root.getChildren().add(lb); //root.getChildren().add(rb1); //root.getChildren().add(rb2); //root.getChildren().add(btn); Scene scene = new Scene(grid, 400, 450); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); }