本文整理汇总了Java中javafx.scene.input.KeyEvent.consume方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.consume方法的具体用法?Java KeyEvent.consume怎么用?Java KeyEvent.consume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.consume方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: thumbKeyPressed
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
void thumbKeyPressed(KeyEvent e) {
if (e.getCode() == KeyCode.BACK_SPACE || e.getCode() == KeyCode.DELETE) {
gradientPicker.removeStop(this);
// Called when removing a gradient stop :
// - update gradient preview accordingly
// - update model
final PaintPickerController paintPicker
= gradientPicker.getPaintPickerController();
final Mode mode = paintPicker.getMode();
final Paint value = gradientPicker.getValue(mode);
gradientPicker.updatePreview(value);
// Update model
paintPicker.setPaintProperty(value);
e.consume();
}
}
示例2: enterAction
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
protected void enterAction(KeyEvent event) {
event.consume();
if (functionText.length() > 0) {
String function = functionText.toString();
append(">> ", promptStyle);
append(function, inputStyle);
inputJoin.send(Channel.LINE, function);
} else {
String text = area.getText();
append(">> ", promptStyle);
append(text, inputStyle);
append("\n", inputStyle);
String line = getLine();
inputJoin.send(Channel.LINE, line);
}
functionText = new StringBuffer();
area.clear();
}
示例3: emailcheck
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
private void emailcheck(KeyEvent k)
{
String c=k.getCharacter();
if(c.equals(" "))
{
k.consume();
}
String EMAIL_REGEX = "^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$";
if(userNameTF.getText().matches(EMAIL_REGEX))
{
validateFalseLabel.setVisible(false);
validateTrueLabel.setVisible(true);
validateTrueLabel.setText("Kindly click on Login");
b=true;
}
else
{
validateTrueLabel.setVisible(false);
validateFalseLabel.setVisible(true);
validateFalseLabel.setText("Invalid E-Mail Format");
b=false;
}
}
示例4: onMessageBoxKeyPressed
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
private void onMessageBoxKeyPressed(KeyEvent event) {
if(KeyCode.ENTER.equals(event.getCode())) {
if (((settings.getControlEnterToSendMessage() && event.isControlDown())
|| (!settings.getControlEnterToSendMessage() && !event.isShiftDown()))
&& !messageBox.getText().isEmpty()) {
Room room = client.getSelectedRoom();
if(room != null) {
try {
room.sendMessage(messageBox.getText());
} catch(SdkException e) {
System.out.printf("SdkException when trying to send a message: %s\n", e);
}
}
messageBox.clear();
event.consume();
} else if(event.isShiftDown()) {
messageBox.insertText(
messageBox.getCaretPosition(),
"\n"
);
}
}
}
示例5: keyPressed
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
private void keyPressed(KeyEvent e) {
switch (e.getCode()) {
case ENTER:
runOnMousePressed();
e.consume();
break;
}
}
示例6: upAction
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
protected void upAction(KeyEvent event) {
event.consume();
if (!readline.getHistory().next()) {
currentLine = getLine();
} else {
readline.getHistory().previous(); // undo check
}
if (!readline.getHistory().previous()) {
return;
}
String oldLine = readline.getHistory().current().trim();
replaceText(oldLine);
}
示例7: downAction
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
protected void downAction(KeyEvent event) {
event.consume();
if (!readline.getHistory().next()) {
return;
}
String oldLine;
if (!readline.getHistory().next()) {
oldLine = currentLine;
} else {
readline.getHistory().previous(); // undo check
oldLine = readline.getHistory().current().trim();
}
replaceText(oldLine);
}
示例8: processKey
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
/**
* Process key.
*
* @param event the event
*/
@FXThread
protected void processKey(@NotNull final KeyEvent event) {
event.consume();
if (event.getCode() == KeyCode.ESCAPE) {
hide();
}
}
示例9: processKeyReleased
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
/**
* Handle the key released event.
*
* @param event the event
*/
@FXThread
protected void processKeyReleased(@NotNull final KeyEvent event) {
final KeyCode code = event.getCode();
if (handleKeyActionImpl(code, false, event.isControlDown(), event.isShiftDown(), false)) {
event.consume();
}
}
示例10: processKeyPressed
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
/**
* Handle the key pressed event.
*
* @param event the event
*/
@FXThread
protected void processKeyPressed(@NotNull final KeyEvent event) {
final KeyCode code = event.getCode();
if (code == KeyCode.S && event.isControlDown() && isDirty()) {
save();
} else if (handleKeyActionImpl(code, true, event.isControlDown(), event.isShiftDown(), false)) {
event.consume();
}
}
示例11: 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();
}
}
示例12: 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
示例13: handle
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@Override public void handle(KeyEvent event) {
if (event.getEventType() != KeyEvent.KEY_PRESSED) {
return;
}
KeyCode code = event.getCode();
switch (code) {
case ENTER:
positionToLastLine();
boolean collect = false;
if (area.getText().toString().endsWith(";")) {
collect = true;
area.setText(area.getText().substring(0, area.getText().length() - 1));
}
if (collect || event.isShiftDown()) {
collectAction();
} else {
if (functionText.length() > 0) {
collectAction();
}
enterAction(event);
area.setEditable(false);
}
break;
case UP:
positionToLastLine();
upAction(event);
break;
case DOWN:
positionToLastLine();
downAction(event);
break;
case LEFT:
case D:
if (event.isControlDown()) {
event.consume();
inputJoin.send(Channel.LINE, EMPTY_LINE);
}
break;
default:
break;
}
}
示例14: onEnter
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
public void onEnter(KeyEvent event) {
String textMessage = textArea.getText();
if(event.getCode() == KeyCode.ENTER) {
Main.botSender.sendMessage(textMessage, Main.bot.currentChannel);
textArea.clear();
event.consume();
}
}