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


Java KeyCombination.CONTROL_DOWN属性代码示例

本文整理汇总了Java中javafx.scene.input.KeyCombination.CONTROL_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCombination.CONTROL_DOWN属性的具体用法?Java KeyCombination.CONTROL_DOWN怎么用?Java KeyCombination.CONTROL_DOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javafx.scene.input.KeyCombination的用法示例。


在下文中一共展示了KeyCombination.CONTROL_DOWN属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyAction

private void keyAction(KeyEvent event, Action add, Action edit, Action delete) {
	if (event.getCode() == KeyCode.DELETE) {
		if (delete != null) {
			delete.act();
		}
		event.consume();
		return;
	}
	if (event.getCode() == KeyCode.ENTER) {
		if (edit != null) {
			edit.act();
		}
		event.consume();
		return;
	}
	KeyCombination combintation = new KeyCodeCombination(KeyCode.N, KeyCombination.CONTROL_DOWN);
	if (combintation.match(event)) {
		if (add != null) {
			add.act();
		}
		event.consume();
		return;
	}
}
 
开发者ID:Co0sh,项目名称:BetonQuest-Editor,代码行数:24,代码来源:EcoController.java

示例2: addMenu

public void addMenu(Control tableView, Runnable copyTableCell, Supplier<String> createCsvFromTable){

        MenuItem item = new MenuItem("Copy cell",uniformDesign.createIcon(FontAwesome.Glyph.COPY));
        item.setOnAction(event -> {
            copyTableCell.run();
        });
        item.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_DOWN));//don't work on ContextMenu but keep is for the display text
        KeyCodeCombination keyCodeCombination = new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_DOWN);
        tableView.addEventFilter(KeyEvent.KEY_RELEASED, event -> {
            if (keyCodeCombination.match(event)) {
                copyTableCell.run();
            }
        });

        MenuItem export = new MenuItem("Copy table (csv)",uniformDesign.createIcon(FontAwesome.Glyph.TABLE));
        export.setOnAction(event -> {
            exportTableToClipboard(createCsvFromTable.get());
        });

        MenuItem fileExport = new MenuItem("Save table (csv)",uniformDesign.createIcon(FontAwesome.Glyph.FILE));
        fileExport.setOnAction(event -> {
            exportTableToFile(createCsvFromTable.get(),tableView.getScene().getWindow());
        });

        ContextMenu menu = new ContextMenu();
        menu.getItems().add(item);
        menu.getItems().add(export);
        menu.getItems().add(fileExport);
        tableView.setContextMenu(menu);
    }
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:30,代码来源:TableMenu.java

示例3: matchMethodName

/**
 * Try to match and auto-complete a method name.
 * 
 * @param codeArea
 * @param e
 */
private void matchMethodName(final ScriptEditorControl control, final KeyEvent e) {
	KeyCodeCombination completionCode = new KeyCodeCombination(KeyCode.SPACE, KeyCombination.CONTROL_DOWN);
	if (!completionCode.match(e)) {
		if (!e.isControlDown())
			completor = null;
		return;
	}
	e.consume();
	if (completor == null)
		completor = new AutoCompletor(control);
	completor.applyNextCompletion();
}
 
开发者ID:qupath,项目名称:qupath,代码行数:18,代码来源:RichScriptEditor.java

示例4: translationKey

@FXML public void translationKey(KeyEvent event) {
	try {
		KeyCombination enter = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.CONTROL_DOWN);
		KeyCombination backspace = new KeyCodeCombination(KeyCode.BACK_SPACE, KeyCombination.CONTROL_DOWN);
		if (enter.match(event)) {
			next();
		} else if (backspace.match(event)) {
			previous();
		}
	} catch (Exception e) {
		ExceptionController.display(e);
	}
}
 
开发者ID:Co0sh,项目名称:BetonQuest-Editor,代码行数:13,代码来源:TranslationController.java

示例5: createPrimaryStage

private void createPrimaryStage() throws IOException {
	URL location = getClass().getResource("view/Root.fxml");
	Locale locale = Persistence.getSettings().getLanguage();
	language = ResourceBundle.getBundle("pl.betoncraft.betonquest.editor.resource.lang.lang", locale);
	FXMLLoader fxmlLoader = new FXMLLoader(location, language);
	BorderPane root = (BorderPane) fxmlLoader.load();
	TabsController.setDisabled(true);
	Scene scene = new Scene(root, 1280, 720);
	scene.getStylesheets().add(getClass().getResource("resource/style.css").toExternalForm());
	KeyCombination save = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN);
	KeyCombination export = new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN);
	scene.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
		if (save.match(event)) {
			event.consume();
			MainMenuController.getInstance().save();
		} else if (export.match(event)) {
			event.consume();
			MainMenuController.getInstance().export();
		}
	});
	stage.setScene(scene);
	stage.setTitle(language.getString("betonquest-editor"));
	stage.getIcons().add(new Image(getClass().getResourceAsStream("resource/icon.png")));
	stage.setMinHeight(600);
	stage.setMinWidth(800);
	stage.setMaximized(true);
	stage.show();
}
 
开发者ID:Co0sh,项目名称:BetonQuest-Editor,代码行数:28,代码来源:BetonQuestEditor.java

示例6: addKeyListeners

/**
 * Add the key combination listeners for firing the "Italic" and "Underline" button.
 * (Work around for the issue)
 */
private void addKeyListeners() {
	final KeyCombination icombination=new KeyCodeCombination(KeyCode.I,KeyCombination.CONTROL_DOWN);
	final KeyCombination ucombination=new KeyCodeCombination(KeyCode.U,KeyCombination.CONTROL_DOWN);
	
	final SimpleObjectProperty<ToggleButton> italicBtn = new SimpleObjectProperty<ToggleButton>();
	final SimpleObjectProperty<ToggleButton> underlineBtn = new SimpleObjectProperty<ToggleButton>();
	
	ToolBar bar = (ToolBar)this.lookup(".bottom-toolbar");
	for (Node node : bar.getItems()) {
		if(node instanceof ToggleButton && node.getUserData().equals("italic")){
			italicBtn.set ( (ToggleButton)node);
		}else if(node instanceof ToggleButton && node.getUserData().equals("underline")){
			underlineBtn.set ( (ToggleButton)node);
		}
	}
	
	this.addEventHandler(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() {
		@Override
		public void handle(KeyEvent event) {
			if(icombination.match(event)){
				italicBtn.get().fire();
			}else if(ucombination.match(event)){
				underlineBtn.get().fire();
			}
		}
	});
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:31,代码来源:HTMLEditorControl.java


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