// you can of course define the text field in FXML if you prefer... TextField newAcronymTextField = new TextField(); newAcronymTextField.setOnAction(e -> { clientAcronymTable.getItems().add(newAcronymTextField.getText()); newAcronymTextField.clear(); });
textField.clear(); });
@Override public void start(Stage primaryStage) { TextField tf = new TextField(); StackPane root = new StackPane(tf); Scene scene = new Scene(root, 300, 200); tf.setOnAction((ActionEvent event) -> { System.out.println(tf.getText()); tf.clear(); root.requestFocus(); }); primaryStage.setScene(scene); primaryStage.show(); }
ListView<String> lv = new ListView<>(); // Make cells editable lv.setEditable(true); lv.setCellFactory(TextFieldListCell.forListView()); // print selected item to the console lv.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { System.out.println("Selected Item: "+ newValue); }); TextField tf = new TextField(); // add new text from the textfield as item to the listview tf.setOnAction((event) -> { lv.getItems().add(tf.getText()); tf.clear(); }); VBox root = new VBox(lv, tf); // TODO: add root to scene
textField.clear(); });
if (source != target) { target.setText(source.getText()); source.clear();
if (!text.isEmpty() && !tags.contains(text)) { tags.add(text); inputTextField.clear();
answerField.clear(); pt.playFromStart();
textField.clear(); });
if (! textField.getText().isEmpty()) table.getItems().add(new Item(Integer.parseInt(textField.getText()))); textField.clear(); });
if (event.getCode() == KeyCode.ENTER) { tagButton(tagsPane, textField.getText()); textField.clear();
textFlow.getChildren().add(text); textField.clear(); textField.requestFocus(); });
textField.clear(); });
if (e.getCode() == KeyCode.ENTER) { obtainData(); textField.clear();
if (!(input.getText() == null || "".equals(input.getText().trim())) { table.getItems().add(input.getText()); input.clear();
public void handle(ActionEvent t) { addLink(urlField.getText().trim()); urlField.clear();