当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.consume方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:18,代码来源:GradientPickerStop.java

示例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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:TextAreaReadline.java

示例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;
   }
  
      
 }
 
开发者ID:ksaluja24,项目名称:scratch-bench,代码行数:27,代码来源:KController.java

示例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"
			);
		}
	}
}
 
开发者ID:Gurgy,项目名称:Cypher,代码行数:27,代码来源:ChatPresenter.java

示例5: keyPressed

import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
@FXML
private void keyPressed(KeyEvent e) {
    switch (e.getCode()) {
        case ENTER:
            runOnMousePressed();
            e.consume();
            break;
    }
}
 
开发者ID:kinmanlui,项目名称:code-tracker,代码行数:10,代码来源:MainController.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:TextAreaReadline.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:TextAreaReadline.java

示例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();
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:13,代码来源:EditorDialog.java

示例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();
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:15,代码来源:AbstractFileEditor.java

示例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();
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:17,代码来源:AbstractFileEditor.java

示例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();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:10,代码来源:PropertyEditorPresenter.java

示例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;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:43,代码来源:TextAreaReadline.java

示例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();
	}
	
	
}
 
开发者ID:artek2001,项目名称:twichat,代码行数:15,代码来源:Controller.java


注:本文中的javafx.scene.input.KeyEvent.consume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。