/** {@inheritDoc} */ @Override protected void completeUserInput(T completion){ String newText = converter.toString(completion); getCompletionTarget().setText(newText); getCompletionTarget().positionCaret(newText.length()); }
@Override protected void completeUserInput(Address completion) { String newText = completion.getStreet(); this.getCompletionTarget().setText(newText); this.getCompletionTarget().positionCaret(newText.length()); } };
@Override public void mapErrorOffsetToCaretPosition() { Integer errorOffset = getErrorOffset(); if (errorOffset != null) { Platform.runLater(() -> { component.getEditor().deselect(); component.getEditor().positionCaret(errorOffset); }); } }
@Override public void mapErrorOffsetToCaretPosition() { Integer errorOffset = getErrorOffset(); if (errorOffset != null && component.isEditable()) { Platform.runLater(() -> { component.getEditor().deselect(); component.getEditor().positionCaret(errorOffset); }); } }
public TagArea() { this.getStylesheets().add(getClass().getResource("style.css").toExternalForm()); getStyleClass().setAll("tag-area"); textField.setMinSize(80, 30); textField.setPrefWidth(80); textField.setOnAction(event -> { this.addTag(textField.getText()); textField.clear(); }); textField.setOnKeyReleased(event -> { System.out.println("[Pressed] Pressed Key: " + event.getCode() + ", Character is: " + event.getCharacter()); if (event.getCode() == KeyCode.BACK_SPACE && textField.getText().length() == 0) { List<Tag> tags = this.getTags(); if (tags.size() != 0) { Tag lastTag = tags.get(tags.size() - 1); removeTag(lastTag); textField.setText(lastTag.getValue()); textField.positionCaret(lastTag.getValue().length()); event.consume(); } } else if (event.getCode() == KeyCode.COMMA) { System.out.println("TextField value is: " + textField.getText()); addTag(textField.getText().replaceAll(",", "")); textField.clear(); event.consume(); } }); this.getChildren().add(textField); }
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());