本文整理了Java中javafx.scene.input.KeyEvent.isShiftDown()
方法的一些代码示例,展示了KeyEvent.isShiftDown()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.isShiftDown()
方法的具体详情如下:
包路径:javafx.scene.input.KeyEvent
类名称:KeyEvent
方法名:isShiftDown
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
private void createEditorNode() {
EventHandler<KeyEvent> keyEventsHandler = t -> {
if (t.getCode() == KeyCode.ENTER) {
commitHelper(false);
} else if (t.getCode() == KeyCode.ESCAPE) {
cancelEdit();
} else if (t.getCode() == KeyCode.TAB) {
commitHelper(false);
editNext(!t.isShiftDown());
}
};
ChangeListener<Boolean> focusChangeListener = (observable, oldValue, newValue) -> {
//This focus listener fires at the end of cell editing when focus is lost
//and when enter is pressed (because that causes the text field to lose focus).
//The problem is that if enter is pressed then cancelEdit is called before this
//listener runs and therefore the text field has been cleaned up. If the
//text field is null we don't commit the edit. This has the useful side effect
//of stopping the double commit.
if (editorNode != null && !newValue) {
commitHelper(true);
}
};
editorNode = builder.createNode(getValue(), keyEventsHandler, focusChangeListener);
}
代码示例来源:origin: jfoenixadmin/JFoenix
if (event.isShiftDown()) {
getBehavior().traverse(getSkinnable(), Direction.PREVIOUS);
} else {
代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg
private boolean isModifierCorrect(KeyEvent t, KeyCode keyCode) {
return (keyCode != KeyCode.ALT ^ t.isAltDown())
&& (keyCode != KeyCode.CONTROL ^ t.isControlDown())
&& (keyCode != KeyCode.SHIFT ^ t.isShiftDown())
&& (keyCode != KeyCode.META ^ t.isMetaDown());
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx
private static boolean hasModifierPressed(KeyEvent event) {
return event.isAltDown() || event.isControlDown() || event.isMetaDown() || event.isShiftDown();
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx
private static int getStateMask(KeyEvent event) {
int rv = 0;
if (event.isAltDown()) {
rv |= FxKeyLookup.ALT;
}
if (event.isControlDown()) {
rv |= FxKeyLookup.CTRL;
}
if (event.isShiftDown()) {
rv |= FxKeyLookup.SHIFT;
}
if (event.isMetaDown()) {
rv |= FxKeyLookup.COMMAND;
}
return rv;
}
代码示例来源:origin: org.tentackle/tentackle-fx
@Override
protected void remapKeys(T control) {
control.addEventFilter(KeyEvent.ANY, (KeyEvent event) -> {
if (event.getCode() == KeyCode.ENTER &&
!event.isControlDown() && !event.isAltDown() && !event.isMetaDown() &&
event.getEventType() == KeyEvent.KEY_PRESSED) {
if (event.isShiftDown()) {
focusPrevious(control);
}
else {
focusNext(control);
}
}
});
}
代码示例来源:origin: org.processing/core
protected void fxKeyEvent(javafx.scene.input.KeyEvent fxEvent) {
int action = 0;
EventType<? extends KeyEvent> et = fxEvent.getEventType();
if (et == KeyEvent.KEY_PRESSED) {
action = processing.event.KeyEvent.PRESS;
} else if (et == KeyEvent.KEY_RELEASED) {
action = processing.event.KeyEvent.RELEASE;
} else if (et == KeyEvent.KEY_TYPED) {
action = processing.event.KeyEvent.TYPE;
}
int modifiers = 0;
if (fxEvent.isShiftDown()) {
modifiers |= processing.event.Event.SHIFT;
}
if (fxEvent.isControlDown()) {
modifiers |= processing.event.Event.CTRL;
}
if (fxEvent.isMetaDown()) {
modifiers |= processing.event.Event.META;
}
if (fxEvent.isAltDown()) {
modifiers |= processing.event.Event.ALT;
}
long when = System.currentTimeMillis();
char keyChar = getKeyChar(fxEvent);
int keyCode = getKeyCode(fxEvent);
sketch.postEvent(new processing.event.KeyEvent(fxEvent, when,
action, modifiers,
keyChar, keyCode));
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
/**
* The event
*
* @param source
* the source
* @param target
* the target
* @param event
* the key
*/
public VerifyEvent(Object source, EventTarget target, KeyEvent event) {
super(source, target, VERIFY);
boolean isKeyTyped = event.getEventType() == KeyEvent.KEY_TYPED;
this.character = isKeyTyped ? event.getCharacter() : KeyEvent.CHAR_UNDEFINED;
this.text = isKeyTyped ? "" : event.getText(); //$NON-NLS-1$
this.code = isKeyTyped ? KeyCode.UNDEFINED : event.getCode();
this.shiftDown = event.isShiftDown();
this.controlDown = event.isControlDown();
this.altDown = event.isAltDown();
this.metaDown = event.isMetaDown();
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
/**
* The event
*
* @param source
* the source
* @param target
* the target
* @param event
* the key
*/
public VerifyEvent(Object source, EventTarget target, KeyEvent event) {
super(source, target, VERIFY);
boolean isKeyTyped = event.getEventType() == KeyEvent.KEY_TYPED;
this.character = isKeyTyped ? event.getCharacter() : KeyEvent.CHAR_UNDEFINED;
this.text = isKeyTyped ? "" : event.getText(); //$NON-NLS-1$
this.code = isKeyTyped ? KeyCode.UNDEFINED : event.getCode();
this.shiftDown = event.isShiftDown();
this.controlDown = event.isControlDown();
this.altDown = event.isAltDown();
this.metaDown = event.isMetaDown();
}
代码示例来源:origin: com.github.wshackle/poseList3DPlot
private void handleKeyEvent(javafx.scene.input.KeyEvent event) {
if (event.isAltDown()) {
double r = event.isShiftDown() ? 1 : -1;
switch (event.getCode()) {
case X:
composeRotation(r, Vector3D.PLUS_I, rxy);
break;
case Y:
composeRotation(r, Vector3D.PLUS_J, rxy);
break;
case Z:
rz.setAngle(rz.getAngle() + r);
break;
}
} else {
double tinc = event.isShiftDown() ? 10 : -10;
switch (event.getCode()) {
case X:
t.setX(t.getX() + tinc);
break;
case Y:
t.setY(t.getY() + tinc);
break;
case Z:
t.setZ(t.getZ() + tinc);
break;
}
}
}
代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit
@Override
public void handle(KeyEvent event)
{
double change = cameraQuantity;
//Add shift modifier to simulate running speed
if (event.isShiftDown())
change = cameraModifier;
KeyCode keyCode = event.getCode();
if (keyCode == KeyCode.W)
cameraNode.setTranslateX(cameraNode.getTranslateX() + change);
if (keyCode == KeyCode.S)
cameraNode.setTranslateX(cameraNode.getTranslateX() - change);
if (keyCode == KeyCode.D)
cameraNode.setTranslateY(cameraNode.getTranslateY() + change);
if (keyCode == KeyCode.A)
cameraNode.setTranslateY(cameraNode.getTranslateY() - change);
}
}
代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit
@Override
public void handle(KeyEvent event)
{
double change = cameraQuantity;
//Add shift modifier to simulate running speed
if (event.isShiftDown())
change = cameraModifier;
KeyCode keyCode = event.getCode();
if (keyCode == KeyCode.W)
cameraNode.setTranslateX(cameraNode.getTranslateX() + change);
if (keyCode == KeyCode.S)
cameraNode.setTranslateX(cameraNode.getTranslateX() - change);
if (keyCode == KeyCode.D)
cameraNode.setTranslateY(cameraNode.getTranslateY() + change);
if (keyCode == KeyCode.A)
cameraNode.setTranslateY(cameraNode.getTranslateY() - change);
}
}
代码示例来源:origin: org.tentackle/tentackle-fx
/**
* Filters certain keys for special features.
*
* @param control the fx control
*/
public void filterKeys(Control control) {
if (control instanceof FxComponent) {
control.addEventFilter(KeyEvent.ANY, event -> {
if (event.getCode() == KeyCode.Z && event.isControlDown() &&
!event.isAltDown() && !event.isMetaDown() && !event.isShiftDown()) {
FxComponent comp = (FxComponent) control;
if (comp.isViewModified()) {
if (event.getEventType() == KeyEvent.KEY_PRESSED) {
// Ctrl-Z pressed and old view value saved: restore it!
comp.setViewObject(comp.getSavedViewObject());
}
event.consume();
}
}
});
}
}
代码示例来源:origin: com.jfoenix/jfoenix
private void createEditorNode() {
EventHandler<KeyEvent> keyEventsHandler = t -> {
if (t.getCode() == KeyCode.ENTER) {
commitHelper(false);
} else if (t.getCode() == KeyCode.ESCAPE) {
cancelEdit();
} else if (t.getCode() == KeyCode.TAB) {
commitHelper(false);
editNext(!t.isShiftDown());
}
};
ChangeListener<Boolean> focusChangeListener = (observable, oldValue, newValue) -> {
//This focus listener fires at the end of cell editing when focus is lost
//and when enter is pressed (because that causes the text field to lose focus).
//The problem is that if enter is pressed then cancelEdit is called before this
//listener runs and therefore the text field has been cleaned up. If the
//text field is null we don't commit the edit. This has the useful side effect
//of stopping the double commit.
if (editorNode != null && !newValue) {
commitHelper(true);
}
};
editorNode = builder.createNode(getValue(), keyEventsHandler, focusChangeListener);
}
代码示例来源: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();
}
}
}
};
代码示例来源:origin: org.tentackle/tentackle-fx
@Override
public void configure(T control) {
super.configure(control);
// first keystroke triggers check for modification
control.textProperty().addListener(o -> ((FxComponent) control).triggerViewModified());
// Shift-Backspace clears the field
control.addEventFilter(KeyEvent.ANY, (KeyEvent event) -> {
if (event.getCode() == KeyCode.BACK_SPACE && event.isShiftDown() &&
!event.isControlDown() && !event.isAltDown() && !event.isMetaDown()) {
if (event.getEventType() == KeyEvent.KEY_PRESSED &&
!control.isDisabled() && control.isEditable()) {
control.clear();
}
event.consume();
}
});
}
代码示例来源:origin: org.tentackle/tentackle-fx
@Override
protected void remapKeys(T control) {
control.addEventFilter(KeyEvent.ANY, (KeyEvent event) -> {
if ((event.getCode() == KeyCode.TAB || event.getCode() == KeyCode.ENTER) &&
!event.isAltDown() && !event.isMetaDown()) {
if (event.getEventType() == KeyEvent.KEY_PRESSED) {
if (event.isControlDown()) {
control.insertText(control.getCaretPosition(), event.getCode() == KeyCode.TAB ? "\t" : "\n");
}
else {
if (event.isShiftDown()) {
focusPrevious(control);
}
else {
focusNext(control);
}
}
}
event.consume();
}
});
}
代码示例来源:origin: org.tentackle/tentackle-fx
@Override
public void configure(T control) {
super.configure(control);
// first keystroke triggers check for modification
control.getEditor().textProperty().addListener(o -> ((FxComponent) control).triggerViewModified());
// Shift-Backspace clears the field
control.addEventFilter(KeyEvent.ANY, (KeyEvent event) -> {
if (event.getCode() == KeyCode.BACK_SPACE && event.isShiftDown() &&
!event.isControlDown() && !event.isAltDown() && !event.isMetaDown()) {
if (event.getEventType() == KeyEvent.KEY_PRESSED &&
!control.getEditor().isDisabled() && control.getEditor().isEditable()) {
control.getEditor().clear();
}
event.consume();
}
});
}
代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit
translationCalculator.setFastModifierPredicate(event -> event.isShiftDown());
translationCalculator.setCameraOrientation(cameraOrientation);
translationCalculator.setZoom(zoomCalculator.zoomProperty());
代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit
translationCalculator.setFastModifierPredicate(event -> event.isShiftDown());
translationCalculator.setCameraOrientation(cameraOrientation);
translationCalculator.setZoom(zoomCalculator.zoomProperty());
内容来源于网络,如有侵权,请联系作者删除!