當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyEvent.getCode方法代碼示例

本文整理匯總了Java中javafx.scene.input.KeyEvent.getCode方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.getCode方法的具體用法?Java KeyEvent.getCode怎麽用?Java KeyEvent.getCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.input.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.getCode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: txtNomeSoftware_onKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@FXML
void txtNomeSoftware_onKeyPressed(KeyEvent event) {
	if (event.getCode() == KeyCode.ENTER) {
		if (txtNomeSoftware.getText().equals("")) {
			preencherTableViewRequisitos(software.buscarTodosSoftwares());
		} else {
			preencherTableViewRequisitos(software.buscarPorNome(txtNomeSoftware.getText()));
		}
	}
}
 
開發者ID:dev-andremonteiro,項目名稱:AlphaLab,代碼行數:11,代碼來源:FrmSolicitarReservaHorarioPorRequisito.java

示例2: onKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
private void onKeyPressed(KeyEvent event) {
    if (event.getCode() == KeyCode.ESCAPE) {
        handleSelection(Selection.CANCEL);
    } else if (event.getCode() == KeyCode.ENTER) {
        Node focusOwner = root.getScene().getFocusOwner();
        if (focusOwner instanceof Button) {
            ((Button) (focusOwner)).fire();
        }
    }
}
 
開發者ID:rmfisher,項目名稱:fx-animation-editor,代碼行數:11,代碼來源:SaveDialogComponent.java

示例3: updateVector

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
/**
 * Update the vector.
 *
 * @param event the event
 */
@FXThread
protected void updateVector(@Nullable final KeyEvent event) {
    if (isIgnoreListener() || (event != null && event.getCode() != KeyCode.ENTER)) return;

    final FloatTextField xField = getXField();
    final float x = xField.getValue();

    final FloatTextField yFiled = getYFiled();
    final float y = yFiled.getValue();

    final FloatTextField zField = getZField();
    final float z = zField.getValue();

    final Vector3f oldValue = getPropertyValue() == null ? Vector3f.ZERO : getPropertyValue();
    final Vector3f newValue = new Vector3f();
    newValue.set(x, y, z);

    changed(newValue, oldValue.clone());
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:25,代碼來源:Vector3FPropertyControl.java

示例4: updateRotation

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
/**
 * Updating rotation.
 */
@FXThread
private void updateRotation(@Nullable final KeyEvent event) {
    if (isIgnoreListener() || (event != null && event.getCode() != KeyCode.ENTER)) return;

    final Quaternion oldValue = notNull(getPropertyValue());

    final FloatTextField xField = getXField();
    final float x = degreeToRadians(xField.getValue());

    final FloatTextField yFiled = getYFiled();
    final float y = degreeToRadians(yFiled.getValue());

    final FloatTextField zField = getZField();
    final float z = degreeToRadians(zField.getValue());

    final Quaternion newValue = new Quaternion();
    newValue.fromAngles(ArrayFactory.toFloatArray(x, y, z));

    changed(newValue, oldValue.clone());
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:24,代碼來源:QuaternionPropertyControl.java

示例5: onKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
protected void onKeyPressed(KeyEvent e) {
    if (e.getCode() == KeyCode.CONTROL || e.getCode() == KeyCode.SHIFT || e.getCode() == KeyCode.ALT
            || e.getCode() == KeyCode.META) {
        return;
    }
    String keyText = OSFXUtils.isModifiers(e) ? OSFXUtils.ketEventGetModifiersExText(e) + "+" : "";
    keyText += OSFXUtils.keyEventGetKeyText(e.getCode());
    keyTriggerField.setText(keyText);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:PreferencesStage.java

示例6: recordRawKeyEvent

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@Override public void recordRawKeyEvent(RFXComponent r, KeyEvent e) {
    JSONObject event = new JSONObject();
    event.put("type", "key_raw");
    KeyCode keyCode = e.getCode();
    if (keyCode.isModifierKey()) {
        return;
    }
    if ((keyCode.isFunctionKey() || keyCode.isArrowKey() || keyCode.isKeypadKey() || keyCode.isMediaKey()
            || keyCode.isNavigationKey() || e.isControlDown() || e.isMetaDown() || e.isAltDown()
            || needManualRecording(keyCode)) && e.getEventType() == KeyEvent.KEY_PRESSED) {
        String mtext = buildModifiersText(e);
        event.put("modifiersEx", mtext);
        KeysMap keysMap = KeysMap.findMap(e.getCode());
        if (keysMap == KeysMap.NULL) {
            return;
        }
        String keyText;
        if (keysMap == null) {
            keyText = e.getText();
        } else {
            keyText = keysMap.toString();
        }
        event.put("keyCode", keyText);
    } else if (e.getEventType() == KeyEvent.KEY_TYPED && !e.isControlDown() && !needManualRecording(keyCode)) {
        char[] cs = e.getCharacter().toCharArray();
        if (cs.length == 0) {
            return;
        }
        for (char c : cs) {
            if (Character.isISOControl(c) && hasMapping(c)) {
                event.put("keyChar", getMapping(c));
            } else {
                event.put("keyChar", "" + c);
            }
        }
    } else {
        return;
    }
    recordEvent(r, event);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:41,代碼來源:WSRecorder.java

示例7: onKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
private void onKeyPressed(KeyEvent event) {
    if (event.isShortcutDown() && event.getCode() == KeyCode.Z) {
        eventBus.post(MenuActionEvent.UNDO);
        event.consume();
    } else if (event.isShortcutDown() && event.getCode() == KeyCode.Y) {
        eventBus.post(MenuActionEvent.REDO);
        event.consume();
    }
}
 
開發者ID:rmfisher,項目名稱:fx-animation-editor,代碼行數:10,代碼來源:PropertyEditorPresenter.java

示例8: processKey

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@Override
@FXThread
protected void processKey(@NotNull final KeyEvent event) {
    if (event.getCode() == KeyCode.ENTER) {
        processClose();
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:8,代碼來源:ConfirmDialog.java

示例9: keyTyped

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@FXML
protected void keyTyped(KeyEvent event) {
    charCount.setText(Integer.toString(msgText.getText().length()));
    if (event.getCode() == KeyCode.TAB) {
        btnSend.requestFocus();
        event.consume();
    }
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:9,代碼來源:SendMessageDialogController.java

示例10: deleteEntries

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
private void deleteEntries(KeyEvent evt) {
    switch (evt.getCode()) {
        case DELETE:
        case BACK_SPACE:
            for (Entry<?> entry : dateControl.getSelections()) {
                if (!dateControl.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dateControl, entry, DateControl.EditOperation.DELETE))) {
                    continue;
                }
                if (entry.isRecurrence()) {
                    entry = entry.getRecurrenceSourceEntry();
                }
                if (!dateControl.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dateControl, entry, DateControl.EditOperation.DELETE))) {
                    continue;
                }

                Calendar calendar = entry.getCalendar();
                if (calendar != null && !calendar.isReadOnly()) {
                    entry.removeFromCalendar();
                }
            }
            dateControl.clearSelection();
            break;
        case F5:
            dateControl.refreshData();
        default:
            break;
    }
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:29,代碼來源:CreateDeleteHandler.java

示例11: handle

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@Override
public void handle(KeyEvent event) {
    switch (event.getCode()) {
        case UP:
            increment();
            break;
        case DOWN:
            decrement();
            break;
        default:
            break;
    }
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:14,代碼來源:TimeFieldSkin.java

示例12: tblPedidos_onKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@FXML
void tblPedidos_onKeyPressed(KeyEvent event) {
	if (event.getCode() == KeyCode.ENTER) {
		if (tblPedidos.getSelectionModel().getSelectedItem() != null) {
			preencherVisualizarDados(tblPedidos.getSelectionModel().getSelectedItem());
			tbpDados.getSelectionModel().select(tabDados);
		}
	}
}
 
開發者ID:dev-andremonteiro,項目名稱:AlphaLab,代碼行數:10,代碼來源:FrmPedidosReserva.java

示例13: ckbFixo_onKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@FXML
void ckbFixo_onKeyPressed(KeyEvent event) {
	if (event.getCode() == KeyCode.TAB)
		btnConfirmar.requestFocus();
}
 
開發者ID:dev-andremonteiro,項目名稱:AlphaLab,代碼行數:6,代碼來源:FrmSolicitarReservaHorarioPorRequisito.java

示例14: btnExcluir_onKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@FXML
void btnExcluir_onKeyPressed(KeyEvent event) {
    if (event.getCode() == KeyCode.ENTER) {
        btnExcluir.fire();
    }
}
 
開發者ID:dev-andremonteiro,項目名稱:AlphaLab,代碼行數:7,代碼來源:FrmCadastroDepartamento.java

示例15: keyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@Override protected void keyPressed(KeyEvent ke) {
    if (ke.getCode() == KeyCode.SPACE) {
        recorder.recordRawKeyEvent(this, ke);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:6,代碼來源:RFXCheckBox.java


注:本文中的javafx.scene.input.KeyEvent.getCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。