當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。