本文整理汇总了Java中javafx.scene.input.KeyCode.ENTER属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCode.ENTER属性的具体用法?Java KeyCode.ENTER怎么用?Java KeyCode.ENTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.scene.input.KeyCode
的用法示例。
在下文中一共展示了KeyCode.ENTER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: txtNomeSoftware_onKeyPressed
@FXML
void txtNomeSoftware_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
if (txtNomeSoftware.getText().equals("")) {
preencherTableViewRequisitos(software.buscarTodosSoftwares());
} else {
preencherTableViewRequisitos(software.buscarPorNome(txtNomeSoftware.getText()));
}
}
}
示例2: processChange
/**
* Handle changing alpha value.
*/
private void processChange(@Nullable final KeyEvent event) {
if (isIgnoreListeners() || (event != null && event.getCode() != KeyCode.ENTER)) return;
final TextField editableControl = getEditableControl();
float newValue;
try {
newValue = Float.parseFloat(editableControl.getText());
} catch (final NumberFormatException e) {
return;
}
newValue = max(min(newValue, 1F), 0F);
final AlphaInfluencerControl control = getControl();
control.requestToChange(newValue, getIndex());
}
示例3: updateValue
/**
* Update the value.
*/
@FXThread
private void updateValue(@Nullable final KeyEvent event) {
if (isIgnoreListener() || (event != null && event.getCode() != KeyCode.ENTER)) return;
final String textValue = getValueField().getText();
int[] newValue = null;
if (!StringUtils.isEmpty(textValue)) {
final String splitter = textValue.contains(" ") ? " " : ",";
final String[] splited = textValue.split(splitter);
newValue = new int[splited.length];
for (int i = 0; i < splited.length; i++) {
try {
newValue[i] = Integer.parseInt(splited[i]);
} catch (final NumberFormatException e) {
LOGGER.warning(this, e);
newValue = getPropertyValue();
break;
}
}
}
changed(newValue, getPropertyValue());
}
示例4: updateValue
/**
* Update the value.
*/
@FXThread
private void updateValue(@Nullable final KeyEvent event) {
if (isIgnoreListener() || (event != null && event.getCode() != KeyCode.ENTER)) return;
final String textValue = getValueField().getText();
float[] newValue = null;
if (!StringUtils.isEmpty(textValue)) {
final String splitter = textValue.contains(" ") ? " " : ",";
final String[] splited = textValue.split(splitter);
newValue = new float[splited.length];
for (int i = 0; i < splited.length; i++) {
try {
newValue[i] = Float.parseFloat(splited[i]);
} catch (final NumberFormatException e) {
LOGGER.warning(this, e);
newValue = getPropertyValue();
break;
}
}
}
changed(newValue, getPropertyValue());
}
示例5: tblPedidos_onKeyPressed
@FXML
void tblPedidos_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
if (tblPedidos.getSelectionModel().getSelectedItem() != null) {
preencherVisualizarDados(tblPedidos.getSelectionModel().getSelectedItem());
tbpDados.getSelectionModel().select(tabDados);
}
}
}
示例6: btnBuscar_onKeyPressed
@FXML
void btnBuscar_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
if (txtNomeSoftware.getText().equals("")) {
preencherTableViewRequisitos(software.buscarTodosSoftwares());
} else {
preencherTableViewRequisitos(software.buscarPorNome(txtNomeSoftware.getText()));
}
}
}
示例7: handle
@Override
public void handle(KeyEvent event) {
TextField editor = comboBox.getEditor();
String text = editor.getText();
if (event.getCode() == KeyCode.RIGHT
|| event.getCode() == KeyCode.LEFT
|| event.isControlDown()
|| event.getCode() == KeyCode.HOME
|| event.getCode() == KeyCode.END
|| event.getCode() == KeyCode.TAB) {
return;
}
else if(event.getCode() == KeyCode.UP) {
caretPos = -1;
moveCaret(text.length());
return;
}
else if(event.getCode() == KeyCode.DOWN) {
if(!comboBox.isShowing()) {
comboBox.show();
}
caretPos = -1;
moveCaret(text.length());
return;
}
else if(event.getCode() == KeyCode.BACK_SPACE) {
moveCaretToPos = true;
caretPos = editor.getCaretPosition();
}
else if(event.getCode() == KeyCode.DELETE) {
moveCaretToPos = true;
caretPos = editor.getCaretPosition();
}
String upperCaseText = text.toUpperCase();
ObservableList<T> list = FXCollections.observableArrayList(data.stream()
.filter(s -> transform.apply(s).toUpperCase().startsWith(upperCaseText))
.collect(Collectors.toList()));
comboBox.setItems(list);
if (event.getCode() == KeyCode.ENTER
|| event.getCode() == KeyCode.ESCAPE) {
if (!list.isEmpty()) {
comboBox.getEditor().setText(transform.apply(list.get(0)));
comboBox.getSelectionModel().select(0);
comboBox.hide();
}
else {
comboBox.getEditor().setText(text);
}
}
else {
comboBox.getEditor().setText(text);
if(!moveCaretToPos) {
caretPos = -1;
}
moveCaret(text.length());
if(!list.isEmpty()) {
comboBox.show();
}
}
}
示例8: processKey
@Override
@FXThread
protected void processKey(@NotNull final KeyEvent event) {
super.processKey(event);
final Button okButton = getOkButton();
if (okButton != null && event.getCode() == KeyCode.ENTER && !okButton.isDisable()) {
processOk();
}
}
示例9: sendMethod
/**
* 设置发送快捷键
* @param event
* @throws IOException
*/
@FXML public void sendMethod(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
sendBtnAction();
}
}
示例10: isEnter
protected boolean isEnter(KeyEvent event) {
return event.getCode() == KeyCode.ENTER;
}
示例11: handleKeyInput
private void handleKeyInput(KeyCode code) {
if(code == KeyCode.ENTER ){
buttonLoginAction();
}
}
示例12: btnProximoRequisitos_onKeyPressed
@FXML
void btnProximoRequisitos_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
btnProximoRequisitos_onAction(new ActionEvent());
}
}
示例13: txtNumMaxAlunos_onKeyPressed
@FXML
void txtNumMaxAlunos_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER)
btnProximoRequisitos_onAction(new ActionEvent());
}
示例14: btnAlterar_onKeyPressed
@FXML
void btnAlterar_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
btnAlterar.fire();
}
}
示例15: btnConfirmar_onKeyPressed
@FXML
void btnConfirmar_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
btnConfirmar.fire();
}
}