本文整理汇总了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()));
}
}
}
示例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();
}
}
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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();
}
}
示例8: processKey
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@Override
@FXThread
protected void processKey(@NotNull final KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
processClose();
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
}
示例13: ckbFixo_onKeyPressed
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
void ckbFixo_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.TAB)
btnConfirmar.requestFocus();
}
示例14: btnExcluir_onKeyPressed
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
void btnExcluir_onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
btnExcluir.fire();
}
}
示例15: keyPressed
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@Override protected void keyPressed(KeyEvent ke) {
if (ke.getCode() == KeyCode.SPACE) {
recorder.recordRawKeyEvent(this, ke);
}
}