本文整理了Java中javafx.scene.input.KeyCode.equals()
方法的一些代码示例,展示了KeyCode.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyCode.equals()
方法的具体详情如下:
包路径:javafx.scene.input.KeyCode
类名称:KeyCode
方法名:equals
暂无
代码示例来源:origin: pmd/pmd
.filter(key -> key.isControlDown() && key.getCode().equals(KeyCode.SPACE))
.map(searchPoint -> myCodeArea.getCaretPosition());
代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX
@Override
public void handle(KeyEvent event) {
if (event.getCode().equals(KeyCode.Q) && event.isControlDown()) {
event.consume();
Platform.exit();
}
}
代码示例来源:origin: brunoborges/webfx
fxView.setOnKeyPressed(e -> {
KeyCode keyCode = e.getCode();
if (keyCode.equals(KeyCode.F5) || (keyCode.equals(KeyCode.R) && e.isControlDown())) {
reload();
if (keyCode.equals(KeyCode.LEFT) && e.isControlDown()) {
goBack();
if (keyCode.equals(KeyCode.RIGHT) && e.isControlDown()) {
goForward();
if (keyCode.equals(KeyCode.Q) && e.isControlDown()) {
System.exit(0);
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
@Override
public void handle(KeyEvent event) {
try {
if (event.getCode().equals(KeyCode.F10)) {
cheatModeActive = !cheatModeActive;
logger.debug("Toggle cheatmode. Cheat active: {}", cheatModeActive);
} else {
if (cheatModeActive && event.isControlDown()) {
if (event.getCode().equals(KeyCode.S)) {
logger.debug("Cheat created a new ship in " + city.getName());
if (event.getCode().equals(KeyCode.W)) {
if (event.getCode().equals(KeyCode.V)) {
debugOutputOn = !debugOutputOn;
List<String> loggerNames = getLoggerNames();
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
public static String showConfirm(String title, String message, String... options) {
final Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.initStyle(StageStyle.UTILITY);
alert.setTitle("Choose an option");
alert.setHeaderText(title);
alert.setContentText(message);
// To make enter key press the actual focused button, not the first one.
// Just like pressing
// "space".
alert.getDialogPane().addEventFilter(KeyEvent.KEY_PRESSED, event -> {
if (event.getCode().equals(KeyCode.ENTER)) {
event.consume();
}
});
if (options == null || options.length == 0) {
options = new String[] {OK, CANCEL};
}
final List<ButtonType> buttons = new ArrayList<>();
for (final String option : options) {
buttons.add(new ButtonType(option));
}
alert.getButtonTypes().setAll(buttons);
final Optional<ButtonType> result = alert.showAndWait();
if (!result.isPresent()) {
return CANCEL;
} else {
return result.get().getText();
}
}
代码示例来源:origin: com.uvic-cfar.swim/worldwind
/**
* Handles the key events to change the current planning time and
* planning time step duration.
*/
@Override
public void handle(KeyEvent event) {
if (KeyCode.RIGHT.equals(event.getCode())) {
if (event.isControlDown()) {
if (0 > this.duration.compareTo(DURATION_MAX)) {
this.duration = this.duration.plusMinutes(1);
}
} else {
this.picker.setLocalDateTime(this.picker.getLocalDateTime().plus(this.duration));
this.picker.getValueValidationCallback().call(this.picker.getLocalDateTime());
}
event.consume();
} else if (KeyCode.LEFT.equals(event.getCode())) {
if (event.isControlDown()) {
if (0 < this.duration.compareTo(Duration.ZERO)) {
this.duration = this.duration.minusMinutes(1);
}
} else {
this.picker.setLocalDateTime(this.picker.getLocalDateTime().minus(this.duration));
this.picker.getValueValidationCallback().call(this.picker.getLocalDateTime());
}
event.consume();
}
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
});
EventHandler<KeyEvent> closeKeyHandler = event -> {
if (event.getCode().equals(KeyCode.ESCAPE)) {
Platform.runLater(() -> {
try {
代码示例来源:origin: org.controlsfx/controlsfx
@Override public void handle(KeyEvent event) {
if (KeyCode.TAB.equals(event.getCode())) {
if (lowThumb.isFocused()) {
if (event.isShiftDown()) {
lowThumb.setFocus(false);
new ParentTraversalEngine(
rangeSlider.getScene().getRoot(), algorithm)
.select(lowThumb, Direction.PREVIOUS)
.requestFocus();
} else {
lowThumb.setFocus(false);
highThumb.setFocus(true);
}
event.consume();
} else if (highThumb.isFocused()) {
if(event.isShiftDown()) {
highThumb.setFocus(false);
lowThumb.setFocus(true);
} else {
highThumb.setFocus(false);
new ParentTraversalEngine(
rangeSlider.getScene().getRoot(), algorithm)
.select(highThumb, Direction.NEXT)
.requestFocus();
}
event.consume();
}
}
}
};
内容来源于网络,如有侵权,请联系作者删除!