Package javafx.scene.input

Examples of javafx.scene.input.KeyCodeCombination


      }
    });
   
    final ContextMenu contextMenu = new ContextMenu();
    final MenuItem copy = new MenuItem("copy");
    copy.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN));
    copy.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        final Clipboard clipboard = Clipboard.getSystemClipboard();
          final ClipboardContent content = new ClipboardContent();
View Full Code Here


   
    final StackPane masterStackPane = new StackPane();
    masterStackPane.setOnKeyReleased(new EventHandler<javafx.scene.input.KeyEvent>() {
      @Override
      public void handle(javafx.scene.input.KeyEvent event) {
        KeyCodeCombination keyCombination = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.SHORTCUT_DOWN);
        if (keyCombination.match(event)){
          refresh();
        }
      }
    });
   
View Full Code Here

    }

    @Test
    public void push_with_combination_for_ALT_A() {
        // when:
        typeRobot.push(new KeyCodeCombination(A, ALT_DOWN));

        // then:
        verify(keyboardRobot, times(1)).pressNoWait(eq(ALT), eq(A));
        verify(keyboardRobot, times(1)).release(eq(A), eq(ALT));
        verifyNoMoreInteractions(keyboardRobot);
View Full Code Here

    }

    @Test
    public void push_with_combination_for_CONTROL_SHIFT_A() {
        // when:
        typeRobot.push(new KeyCodeCombination(A, CONTROL_DOWN, SHIFT_DOWN));

        // then:
        verify(keyboardRobot, times(1)).pressNoWait(eq(SHIFT), eq(CONTROL), eq(A));
        verify(keyboardRobot, times(1)).release(eq(A), eq(CONTROL), eq(SHIFT));
        verifyNoMoreInteractions(keyboardRobot);
View Full Code Here

        controller.setTableStage(tableStage);

        stage.setScene(scene);
        stage.show();

        scene.getAccelerators().put(new KeyCodeCombination(KeyCode.S, CONTROL_DOWN), controller::saveDoc);
        scene.getAccelerators().put(new KeyCodeCombination(KeyCode.N,CONTROL_DOWN), () -> {
                controller.newDoc(null);
        });

    }
View Full Code Here

                };

                go.setOnAction(goAction);

                MenuItem menuItem = new MenuItem("Go!");
                menuItem.setAccelerator(new KeyCodeCombination(KeyCode.G, KeyCombination.CONTROL_DOWN));
                menuItem.setOnAction(goAction);

                browser.getEngine().locationProperty().addListener(new ChangeListener<String>() {
                    @Override
                    public void changed(ObservableValue<? extends String> observableValue, String s, String newLoc) {
View Full Code Here

  private void setTextAreaSaveCombo(TextArea textArea)
  {
    textArea.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>()
    {
      final KeyCombination combo = new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN);

      @Override
      public void handle(KeyEvent event)
      {
        // check for only tab key
        if (combo.match(event))
        {
          saveFile();
          event.consume();
        }
      }
View Full Code Here

                };

                go.setOnAction(goAction);

                MenuItem menuItem = new MenuItem("Go!");
                menuItem.setAccelerator(new KeyCodeCombination(KeyCode.G, KeyCombination.CONTROL_DOWN));
                menuItem.setOnAction(goAction);


                HBox toolbar = new HBox();
                toolbar.getChildren().addAll(location, go);
View Full Code Here

     * @param scene
     */
    public void installAccelerators(Scene scene) {
        // Accelerators
        if (stage.isResizable()) {
            scene.getAccelerators().put(new KeyCodeCombination(KeyCode.F, KeyCombination.CONTROL_DOWN, KeyCombination.SHORTCUT_DOWN), new Runnable() {
                @Override
                public void run() {
                    switchFullscreen();
                }
            });
        }
        scene.getAccelerators().put(new KeyCodeCombination(KeyCode.M, KeyCombination.SHORTCUT_DOWN), new Runnable() {
            @Override
            public void run() {
                switchMinimize();
            }
        });
        scene.getAccelerators().put(new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN), new Runnable() {
            @Override
            public void run() {
                switchClose();
            }
        });
View Full Code Here

        // Menu
        final ContextMenu contextMenu = new ContextMenu();
        contextMenu.setAutoHide(true);
        if (minimize != null) { // Utility Stage
            minimizeMenuItem = new MenuItem(LOC.getString("Minimize"));
            minimizeMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.M, KeyCombination.SHORTCUT_DOWN));

            minimizeMenuItem.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent e) {
                    switchMinimize();
                }
            });
            contextMenu.getItems().add(minimizeMenuItem);
        }
        if (maximize != null && stage.isResizable()) { // Utility Stage type
            maximizeMenuItem = new MenuItem(LOC.getString("Maximize"));
            maximizeMenuItem.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent e) {
                    switchMaximize();
                    contextMenu.hide(); // Stay stuck on screen
                }
            });
            contextMenu.getItems().addAll(maximizeMenuItem, new SeparatorMenuItem());
        }

        // Fullscreen
        if (stageStyle != StageStyle.UTILITY && stage.isResizable()) {
            fullScreenMenuItem = new CheckMenuItem(LOC.getString("FullScreen"));
            fullScreenMenuItem.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent e) {
                    // fake
                    //maximizeProperty().set(!maximizeProperty().get());
                    switchFullscreen();
                }
            });
            fullScreenMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.F, KeyCombination.CONTROL_DOWN, KeyCombination.SHORTCUT_DOWN));

            contextMenu.getItems().addAll(fullScreenMenuItem, new SeparatorMenuItem());
        }

        // Close
        MenuItem closeMenuItem = new MenuItem(LOC.getString("Close"));
        closeMenuItem.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                switchClose();
            }
        });
        closeMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN));

        contextMenu.getItems().add(closeMenuItem);

        menu.setOnMousePressed(new EventHandler<MouseEvent>() {
            @Override
View Full Code Here

TOP

Related Classes of javafx.scene.input.KeyCodeCombination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.