List of usage examples for javafx.scene.control TextField getText
public final String getText()
From source file:account.management.controller.inventory.InsertStockController.java
public void calculateTotal() { double total = 0; try {/*from w ww . j a v a 2 s . c o m*/ 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:net.rptools.tokentool.util.FileSaveUtil.java
public File getFileName(boolean asToken, boolean useNumbering, String tempFileName, TextField fileNameSuffix) throws IOException { final String _extension; _extension = AppConstants.DEFAULT_IMAGE_EXTENSION; if (useNumbering) { int dragCounter; try {/*from w ww.ja v a 2 s.com*/ dragCounter = Integer.parseInt(fileNameSuffix.getText()); } catch (NumberFormatException e) { dragCounter = 0; } String leadingZeroes = "%0" + fileNameSuffix.getLength() + "d"; fileNameSuffix.setText(String.format(leadingZeroes, dragCounter + 1)); if (tempFileName.isEmpty()) tempFileName = AppConstants.DEFAULT_TOKEN_NAME; if (lastFile != null) { return new File(lastFile.getParent(), String.format("%s_" + leadingZeroes + _extension, tempFileName, dragCounter)); } else { return new File(String.format("%s_" + leadingZeroes + _extension, tempFileName, dragCounter)); } } else { if (lastFile != null) if (tempFileName.isEmpty()) tempFileName = AppConstants.DEFAULT_TOKEN_NAME + _extension; if (!tempFileName.endsWith(_extension)) tempFileName += _extension; if (lastFile != null) lastFile = new File(lastFile.getParent(), tempFileName); else lastFile = new File(tempFileName); return lastFile; } }
From source file:clientechat.TestList.java
@Override public void start(Stage primaryStage) { WebView wv = new WebView(); Button btn = new Button(); TextField textField = new TextField(); VBox vb = new VBox(); WebEngine appendEngine = wv.getEngine(); btn.setOnAction(new EventHandler<ActionEvent>() { @Override/*from w ww. ja va 2 s. co m*/ public void handle(ActionEvent event) { executejQuery(appendEngine, "$('#content').append(\"<p align=right><b>World!" + escapeHtml(textField.getText()) + "<b><p>\");"); executejQuery(appendEngine, "$(\"html, body\").animate({ scrollTop: $(document).height()-$(window).height() });"); } }); wv.getEngine().loadContent( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + "<head>\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n" + "<title>Documento sin ttulo</title>\n" + "</head>\n" + "\n" + "<body id=\"content\">\n" + " \n" + "</body>\n" + "</html>"); vb.getChildren().addAll(wv, btn, textField); Scene scene = new Scene(vb); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); }
From source file:account.management.controller.expenseVoucherController.java
@FXML private void onSaveButtonClick(ActionEvent event) { try {//from www .j a va 2s . co m String date = "", location = "", receivers_name = "", receivers_address = "", via = "", via_address = "", in_word = "", total = "", expenses = "[]"; if (!this.date.getEditor().getText().equals("")) { date = this.date.getValue().toString(); date = new SimpleDateFormat("yyyy-MM-dd").format(new SimpleDateFormat("yyyy-MM-dd").parse(date)); } if (!this.location.getSelectionModel().isEmpty()) location = String.valueOf(this.location.getSelectionModel().getSelectedItem().getId()); if (!this.receivers_name.getText().equals("")) receivers_name = this.receivers_name.getText(); if (!this.receivers_address.getText().equals("")) receivers_address = this.receivers_address.getText(); if (!this.via_name.getText().equals("")) via = this.via_name.getText(); if (!this.via_address.getText().equals("")) via_address = this.via_address.getText(); if (!this.in_word.getText().equals("")) in_word = this.in_word.getText(); if (!this.total.getText().equals("")) total = this.total.getText(); JSONArray expenses_array = new JSONArray(); for (int i = 0; i < this.container.getChildren().size(); i++) { JSONObject obj = new JSONObject(); HBox row = (HBox) this.container.getChildren().get(i); TextField desc = (TextField) row.getChildren().get(0); TextField amount = (TextField) row.getChildren().get(1); obj.put("description", desc.getText()); obj.put("amount", amount.getText()); expenses_array.put(obj); } expenses = expenses_array.toString(); HttpResponse<String> res = Unirest.get(MetaData.baseUrl + "add/expenseVoucher") .queryString("date", date).queryString("location", location) .queryString("receivers_name", receivers_name) .queryString("receivers_address", receivers_address).queryString("via", via) .queryString("via_address", via_address).queryString("in_word", in_word) .queryString("total", total).queryString("expenses", expenses).asString(); System.out.println(expenses); if (res.getBody().equals("success")) { Msg.showInformation("Expense voucher has been saved successfully."); Report report = new Report(); Vector v = new Vector(); HashMap params = new HashMap(); params.put("date", new SimpleDateFormat("dd-MM-yyyy") .format(new SimpleDateFormat("yyyy-MM-dd").parse(this.date.getValue().toString()))); params.put("rcv_name", receivers_name); params.put("rcv_address", receivers_address); params.put("via_name", via); params.put("via_address", via_address); params.put("total_word", in_word); int sl = 1; for (int i = 0; i < expenses_array.length(); i++) { JSONObject obj = expenses_array.getJSONObject(i); v.add(new ExpenseVoucherEntry(String.valueOf(sl++), obj.getString("description"), obj.getString("amount"))); } report.getReport("src\\report\\ExpenseVoucher.jrxml", new JRBeanCollectionDataSource(v), params, "Credit Voucher"); } else { Msg.showError(""); } } catch (Exception ex) { Msg.showError(""); } }
From source file:account.management.controller.inventory.InsertStockController.java
@FXML private void onSaveButtonClick(ActionEvent event) { this.save.setDisable(true); try {//www . j av a 2s . c o m String date = new SimpleDateFormat("yyyy-MM-dd") .format(new SimpleDateFormat("yyyy-MM-dd").parse(this.date.getValue().toString())); JSONArray array = new JSONArray(); for (int i = 0; i < this.conatiner.getChildren().size(); i++) { HBox row = (HBox) this.conatiner.getChildren().get(i); ComboBox<Product> item = (ComboBox) row.getChildren().get(0); TextField qty = (TextField) row.getChildren().get(1); TextField rate = (TextField) row.getChildren().get(2); JSONObject obj = new JSONObject(); obj.put("id", item.getSelectionModel().getSelectedItem().getId()); obj.put("quantity", qty.getText()); obj.put("rate", rate.getText()); array.put(obj); } Unirest.post(MetaData.baseUrl + "products/ledger") .field("voucher_type", this.voucher_type.getSelectionModel().getSelectedItem()) .field("date", date).field("products", array).asString(); Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText(null); alert.setContentText("Ledger has been saved successfully!"); alert.setGraphic(new ImageView(new Image("resources/success.jpg"))); alert.showAndWait(); this.save.setDisable(false); } catch (Exception ex) { Logger.getLogger(InsertStockController.class.getName()).log(Level.SEVERE, null, ex); Alert alert = new Alert(Alert.AlertType.ERROR); alert.setHeaderText(null); alert.setContentText("Sorry!! there is an error. Please try again."); alert.setGraphic(new ImageView(new Image("resources/error.jpg"))); alert.showAndWait(); } }
From source file:hd3gtv.as5kpc.Serverchannel.java
void appRec(TextField mediaid, int _take, TextField showname) { int _id;/* ww w. j av a 2s .c om*/ try { _id = Integer.parseInt(mediaid.getText()); } catch (Exception e) { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Media ID"); alert.setHeaderText("Erreur lors de la rcupration de l'ID, seuls des chiffres sont autoriss."); alert.setContentText("Dtail: " + e.getMessage()); alert.showAndWait(); return; } if (independant_channel) { _id += getVtrIndex(); } RecBackgound rec = createRecBackgound(makeValidId(_id, _take), makeName(getServerLabel(), showname)); rec.start(); }
From source file:hd3gtv.as5kpc.Serverchannel.java
void appCue(TextField mediaid, Label takenum, TextField showname, Button btncue, Button btnrec) { int id;/*from w ww .j a va2 s . co m*/ int take; try { id = Integer.parseInt(mediaid.getText()); take = Integer.valueOf(takenum.getText()); } catch (Exception e) { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Media ID"); alert.setHeaderText("Erreur lors de la rcupration de l'ID, seuls des chiffres sont autoriss."); alert.setContentText("Dtail: " + e.getMessage()); alert.showAndWait(); return; } GetFreeClipIdBackgound gfip = getFreeClipIdBackgound(id + getVtrIndex(), take); gfip.setOnSucceeded((WorkerStateEvent ev) -> { takenum.setText(gfip.getValue().get("take")); String first_name = gfip.getValue().get("first_name"); if (first_name != null) { final String _first_name = first_name.substring("00-00 ".length()); showname.setText(_first_name); if (_first_name.endsWith(getServerLabel())) { showname.setText( _first_name.substring(0, _first_name.length() - getServerLabel().length()).trim()); } } btncue.setDisable(false); mediaid.setDisable(false); showname.setDisable(false); btnrec.setDisable(false); }); gfip.setOnFailed((WorkerStateEvent ev) -> { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Cue"); alert.setHeaderText("Impossible de rcuperer un tat"); alert.setContentText("La rcupration du statut de l'Id " + id + " n'a pas fonctionn."); alert.showAndWait(); mediaid.setDisable(false); showname.setDisable(false); }); gfip.start(); }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addRow5(final Pane content, final BookingBean be) { final HBox box = new HBox(); box.setPadding(new Insets(4)); box.setFillHeight(true);//from ww w .java 2s . co m final Text text = new Text("Welcome Mail sent: "); final CheckBox checkBox = new CheckBox(); checkBox.setSelected(be.isWelcomeMailSend()); booking2WelcomeMail.put(be, checkBox); final Text t1 = new Text(" \tPayment done: "); final CheckBox cb1 = new CheckBox(); cb1.setSelected(be.isPaymentDone()); //if (logger.isDebugEnabled()) { // logger.debug("DateOfPayment for " + be + "(" + be.hashCode() + ") is " + be.getDateOfPayment()); //} final DatePicker dp = new DatePicker(); dp.setValue(be.getDateOfPayment()); dp.setPrefWidth(140); booking2PaymentDate.put(be, dp); booking2Payment.put(be, cb1); final TextFlow tf = new TextFlow(); tf.getChildren().addAll(text, checkBox, t1, cb1, dp); box.getChildren().add(tf); if (!be.isWelcomeMailSend() || !be.isPaymentDone()) { box.getStyleClass().addAll("warning", "warning-bg"); } else { box.getStyleClass().removeAll("warning", "warning-bg"); } HBox box2 = new HBox(); box2.setPadding(new Insets(4)); box2.setFillHeight(true); TextField newPayment = new TextField(); Button addNewPaymentButton = new Button("Add payment"); addNewPaymentButton.setOnAction(e -> { addNewPayment(newPayment.getText(), be); }); box2.getChildren().addAll(newPayment, addNewPaymentButton); content.getChildren().addAll(box, box2); }
From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java
public void runLogFileReader(final RadioButton inputTypeFile, final TextField pathInput, final TextArea logInputText) { this.parsedLogEntryItems.clear(); try {/*from w w w .jav a 2 s . c o m*/ GenericLogReader reader; if (inputTypeFile.isSelected()) { reader = new GenericLogReader(new File(pathInput.getText())); } else { reader = new GenericLogReader(new BufferedReader(new StringReader(logInputText.getText()))); } reader.overwriteCurrentSettingsWithSettingsInConfigurationFile( this.logReader.getSettingsForConfigurationFile()); this.logReader = reader; ILogEntry nextLogEntry; while ((nextLogEntry = reader.getNextEntry()) != null) { this.parsedLogEntryItems.add(new LogEntryTableRow(nextLogEntry)); } } catch (final RuntimeException re) { ExceptionDialog.showFatalException("Error reading log entries", "An error occurred while reading the log entries.", re); } }
From source file:com.playonlinux.javafx.mainwindow.console.ConsoleTab.java
public ConsoleTab(CommandLineInterpreterFactory commandLineInterpreterFactory) { final VBox content = new VBox(); commandInterpreter = commandLineInterpreterFactory.createInstance(); this.setText(translate("Console")); this.setContent(content); final TextField command = new TextField(); command.getStyleClass().add("consoleCommandType"); final TextFlow console = new TextFlow(); final ScrollPane consolePane = new ScrollPane(console); content.getStyleClass().add("rightPane"); consolePane.getStyleClass().add("console"); consolePane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); content.getChildren().addAll(consolePane, command); command.requestFocus();/*ww w . j a v a 2 s . co m*/ command.setOnKeyPressed(event -> { if (event.getCode() == KeyCode.ENTER) { final String commandToSend = command.getText(); final int cursorPosition = command.getCaretPosition(); command.setDisable(true); commandHistory.add(new CommandHistory.Item(commandToSend, cursorPosition)); Text commandText = new Text(nextSymbol + commandToSend + "\n"); commandText.getStyleClass().add("commandText"); console.getChildren().add(commandText); command.setText(""); if (commandInterpreter.sendLine(commandToSend, message -> { Platform.runLater(() -> { if (!StringUtils.isBlank(message)) { Text resultText = new Text(message); resultText.getStyleClass().add("resultText"); console.getChildren().add(resultText); } command.setDisable(false); command.requestFocus(); consolePane.setVvalue(consolePane.getVmax()); }); })) { nextSymbol = NOT_INSIDE_BLOCK; } else { nextSymbol = INSIDE_BLOCK; } } }); command.setOnKeyReleased(event -> { if (event.getCode() == KeyCode.UP) { CommandHistory.Item historyItem = commandHistory.up(); command.setText(historyItem.getCommand()); command.positionCaret(historyItem.getCursorPosition()); } else if (event.getCode() == KeyCode.DOWN) { CommandHistory.Item historyItem = commandHistory.down(); command.setText(historyItem.getCommand()); command.positionCaret(historyItem.getCursorPosition()); } }); this.setOnCloseRequest(event -> commandInterpreter.close()); }