Java 类javafx.scene.input.KeyEvent 实例源码

项目:fwm    文件:HotkeyController.java   
public void start(Stage primaryStage, ScrollPane rootLayout) throws Exception {
    primaryStage.setTitle("Change Hotkeys");
    Scene myScene = new Scene(rootLayout);
    ourStage = primaryStage;
    myScene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
        public void handle(KeyEvent event) {
            if (changeHotkey) {
                if (addHotkey(event, changeHotkeyFunction)) {
                    changeHotkey = false;
                }
            }
        }
    });
    Label divider = new Label();
    HBox labelHbox = new HBox(divider);
    divider.setText("----These hotkeys are not changeable----");
    labelHbox.setAlignment(Pos.CENTER);
    for (String key : HOTKEYS) {
        hotkeyVBox.getChildren().add(hotkeys.get(key).getHotkeyHBox());
    }
    hotkeyVBox.getChildren().add(labelHbox);
    for (ImmutableHotkey hotkey : IMMUTABLE_HOTKEYS) {
        hotkeyVBox.getChildren().add(hotkey.getHotkeyHBox());
    }
    primaryStage.setScene(myScene);
}
项目:FYS_T3    文件:searchLugController.java   
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
项目:FYS_T3    文件:contactController.java   
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
项目:jmonkeybuilder    文件:QuaternionPropertyControl.java   
/**
 * Updating rotation.
 */
@FXThread
private void updateRotation(@Nullable final KeyEvent event) {
    if (isIgnoreListener() || (event != null && event.getCode() != KeyCode.ENTER)) return;

    final Quaternion oldValue = notNull(getPropertyValue());

    final FloatTextField xField = getXField();
    final float x = degreeToRadians(xField.getValue());

    final FloatTextField yFiled = getYFiled();
    final float y = degreeToRadians(yFiled.getValue());

    final FloatTextField zField = getZField();
    final float z = degreeToRadians(zField.getValue());

    final Quaternion newValue = new Quaternion();
    newValue.fromAngles(ArrayFactory.toFloatArray(x, y, z));

    changed(newValue, oldValue.clone());
}
项目:FYS_T3    文件:homepageController.java   
@FXML
public void openCreditsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Credits.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
项目:marathonv5    文件:TextAreaReadline.java   
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();
}
项目:fx-animation-editor    文件:SaveDialogComponent.java   
private void onKeyPressed(KeyEvent event) {
    if (event.getCode() == KeyCode.ESCAPE) {
        handleSelection(Selection.CANCEL);
    } else if (event.getCode() == KeyCode.ENTER) {
        Node focusOwner = root.getScene().getFocusOwner();
        if (focusOwner instanceof Button) {
            ((Button) (focusOwner)).fire();
        }
    }
}
项目:marathonv5    文件:OSFXUtils.java   
public static String ketEventGetModifiersExText(KeyEvent event) {
    StringBuffer sb = new StringBuffer();

    if (event.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (event.isMetaDown()) {
        sb.append("Meta+");
    }
    if (event.isAltDown()) {
        sb.append("Alt+");
    }
    if (event.isShiftDown()) {
        sb.append("Shift+");
    }
    String text = sb.toString();
    if (text.equals("")) {
        return text;
    }
    return text.substring(0, text.length() - 1);
}
项目:marathonv5    文件:FXEventQueueDevice.java   
private void sendKey(Node node, char c) {
    node = getActiveNode(node);
    JavaAgentKeys keys = JavaAgentKeys.getKeyFromUnicode(c);
    if (keys == null) {
        dispatchKeyEvent(node, null, KeyEvent.KEY_PRESSED, c);
        if (deviceState.getModifierEx() == 0) {
            dispatchKeyEvent(node, null, KeyEvent.KEY_TYPED, c);
        }
        dispatchKeyEvent(node, null, KeyEvent.KEY_RELEASED, c);
        return;
    }
    if (keys == JavaAgentKeys.NULL) {
        resetModifierState(node);
    } else if (deviceState.isModifier(keys)) {
        pressKey(node, keys);
    } else {
        pressKey(node, keys);
        if (keys == JavaAgentKeys.SPACE) {
            dispatchKeyEvent(node, null, KeyEvent.KEY_TYPED, ' ');
        }
        releaseKey(node, keys);
    }
}
项目:marathonv5    文件:EventQueueDeviceTest.java   
private static String checkModifier(KeyEvent e) {
    String s = "";
    if (e.isShiftDown()) {
        s = "Shift";
    }
    if (e.isControlDown()) {
        s = "Ctrl";
    }
    if (e.isAltDown()) {
        s = "Alt";
    }
    if (e.isMetaDown()) {
        s = "Meta";
    }
    return s;
}
项目:jrfl    文件:Command.java   
/**
 * Adds an auto-completion to a certain argument - Must be added in decreasing order
 * @param index Arg index
 * @param completion Completion type
 */
@SuppressWarnings("deprecation")
protected void setArgCompletion(int index, TabCompletion completion) {
    completions.put(index, completion);
    Nodes.TEXTFIELD.addEventHandler(KeyEvent.KEY_RELEASED, e -> {
        if(e.getCode() == KeyCode.TAB) {
            String t = Nodes.TEXTFIELD.getText() + "\0";
            String[] args = Formatter.getInstance().format(t).split(" ");
            if(args.length == 1 && args[0].replace("\0", "").isEmpty() && completion instanceof InitialCommandTabCompletion) {
                completion.onTab(new String[] {""});
            }
            else if(args.length > 0 && (args[0].equals(name) || args.length == 1)) {
                if(args.length == index + 2) {
                    List<String> list = Arrays.asList(args);
                    list.set(list.size()-1, list.get(list.size()-1).replace("\0", ""));
                    completion.onTab(list.toArray(new String[list.size()]));
                }
            }
        }
    });
}
项目:marathonv5    文件:WSRecorder.java   
private String buildModifiersText(KeyEvent e) {
    StringBuilder sb = new StringBuilder();
    if (e.isAltDown()) {
        sb.append("Alt+");
    }
    if (e.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (e.isMetaDown()) {
        sb.append("Meta+");
    }
    if (e.isShiftDown()) {
        sb.append("Shift+");
    }
    if (sb.length() > 0) {
        sb.setLength(sb.length() - 1);
    }
    String mtext = sb.toString();
    return mtext;
}
项目:FYS_T3    文件:homepageController.java   
@FXML
public void openStatisticsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Statistics.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
项目:FYS_T3    文件:homepageController.java   
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
项目:marathonv5    文件:JavaFxRecorderHook.java   
private boolean isContextMenuKeyEvent(KeyEvent event) {
    if (!event.getEventType().equals(KeyEvent.KEY_PRESSED)) {
        return false;
    }
    if (event.getCode() == KeyCode.CONTROL || event.getCode() == KeyCode.SHIFT || event.getCode() == KeyCode.ALT
            || event.getCode() == KeyCode.META) {
        return false;
    }
    String keyText = isModifiers(event) ? ketEventGetModifiersExText(event) + "+" : "";
    keyText += keyEventGetKeyText(event.getCode());
    StringBuffer contextMenuText = new StringBuffer();
    if (keyModifiers != null && !keyModifiers.equals("")) {
        contextMenuText.append(keyModifiers + "+");
    }
    contextMenuText.append(key);
    return contextMenuText.toString().equals(keyText);
}
项目:marathonv5    文件:JavaFxRecorderHook.java   
public static String ketEventGetModifiersExText(KeyEvent event) {
    StringBuffer sb = new StringBuffer();

    if (event.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (event.isMetaDown()) {
        sb.append("Meta+");
    }
    if (event.isAltDown()) {
        sb.append("Alt+");
    }
    if (event.isShiftDown()) {
        sb.append("Shift+");
    }
    String text = sb.toString();
    if (text.equals("")) {
        return text;
    }
    return text.substring(0, text.length() - 1);
}
项目:scratch-bench    文件:KController.java   
@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;
   }


 }
项目:GameAuthoringEnvironment    文件:IOInterpeter.java   
private void setUpListener (Scene scene, Pane pane) {
    pane.requestFocus();
    pane.setOnMouseClicked(e -> queue(myEventFactory.interpretEvent(e, myScale.getScale(),
                                                                    myScale.getScale())));
    scene.addEventFilter(KeyEvent.KEY_RELEASED, e -> queue(myEventFactory.interpretEvent(e)));
    scene.addEventFilter(KeyEvent.KEY_PRESSED, e -> queue(myEventFactory.interpretEvent(e)));
}
项目:ETUmulator    文件:Thumb2CodeArea.java   
public Thumb2CodeArea() {
    getStylesheets().clear();
    getStylesheets().add(Thumb2CodeArea.class.getClassLoader()
            .getResource("styles/thumb2-syntax-highlight.css").toExternalForm());
    getStylesheets().add(Thumb2CodeArea.class.getClassLoader()
            .getResource("styles/spellchecking.css").toExternalForm());
    setCursor(Cursor.TEXT);
    richChanges().filter(ch -> !ch.getInserted().equals(ch.getRemoved()))
            .subscribe(change -> {
                SyntaxHighlighter syntaxHighlighter = new SyntaxHighlighter();
                setStyleSpans(0, syntaxHighlighter.highlight(getText()));
            });
    addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent e) -> {
        if(e.getCode() == KeyCode.TAB) {
            String s = "    ";
            insertText(getCaretPosition(), s);
            e.consume();
        }
    });
}
项目:Parallator    文件:Main.java   
@Override
public void start(Stage rootStage) throws Exception {
    rootStage.setMaximized(true);
    main = this;

    FXMLLoader loader = new FXMLLoader(getClass().getResource("/resources/layouts/main.fxml"));

    Parent root = loader.load();

    Scene rootScene = new Scene(root);

    rootStage.setTitle("Parallator");

    rootController = loader.getController();

    rootStage.setScene(rootScene);

    initMenu(rootStage);

    rootStage.show();
    rootStage.setOnCloseRequest(event -> {
        if (rootController.getFile() == null || !rootController.isEdited()) return;
        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setHeaderText("Сохранить перед выходом?");
        alert.getButtonTypes().setAll(ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
        Optional<ButtonType> result = alert.showAndWait();
        if (result.isPresent() && result.get() == ButtonType.YES) {
            rootController.save();
        }
        if (result.isPresent() && result.get() == ButtonType.CANCEL) {
            event.consume();
        }
    });

    rootScene.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
        switch (event.getCode()) {
            case DOWN:
                rootController.down();
                break;
            case UP:
                rootController.up();
                break;
        }
    });

    if (MainConfig.getMainConfig().path() != null) rootController.open(new File(MainConfig.getMainConfig().path()));
}
项目:EMBER    文件:NewTaskListWindow.java   
/**
 * Builds the window and add events.
 * @throws IOException 
 */
public NewTaskListWindow() throws IOException {
    super();
    FXMLLoader fxmlLoader = new FXMLLoader(
            getClass().getResource("/FXML/newTaskList.fxml"));
    Parent root = (Parent) fxmlLoader.load();
    taskListController
            = (NewTaskListController) fxmlLoader.getController();

    Scene scene = new Scene(root);
    setScene(scene);
    setResizable(false);
    initStyle(StageStyle.TRANSPARENT);

    this.wantsToAdd = false;
    //After pressing 'Enter', closes this window (which returns the value)
    scene.setOnKeyPressed((final KeyEvent keyEvent) -> {
        if (keyEvent.getCode() == KeyCode.ENTER) {
            this.wantsToAdd = true;
            this.close();
        } else if (keyEvent.getCode() == KeyCode.ESCAPE) {
            this.close();
        }
    });

    //Not focusing the window means closing it
    focusedProperty().addListener((obs, wasFocused, isNowFocused) -> {
        if (!isNowFocused) {
            close();
        }
    });
}
项目:FYS_T3    文件:homepageController.java   
/**
 *
 * @author shabier
 */
    @FXML
    public void openHome(ActionEvent event) throws IOException {
//        MyJDBC.createTestDatabase("shabo");
        Node node = (Node) event.getSource();
        final Stage stage = (Stage) node.getScene().getWindow();
        Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
        stage.centerOnScreen();

        final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
        final Scene hScene = new Scene(home);
        root.setOnKeyPressed(new EventHandler<KeyEvent>() {
            public void handle(KeyEvent ke) {
                if (ke.getCode() == KeyCode.ESCAPE) {
                    System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                    stage.setScene(hScene);
                }
            }
        });
    }
项目:everywhere    文件:Controller.java   
public void getKeyTyped(KeyEvent keyEvent) {
    if ("\b".equals(keyEvent.getCharacter()) && !searchText.isEmpty()) {
        searchText = searchText.substring(0, searchText.length() - 1);
    } else {
        if (!keyEvent.getCharacter().contains("\\")) {
           searchText += keyEvent.getCharacter();
        }
    }
    System.out.println(searchText);
    if (!searchText.isEmpty()) {
        List<SearchedResult> searchedResults = getSearchResult(searchText, searchField);
        showTableData(searchedResults);
    } else {
        tview.getItems().clear();
    }
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * 
 * @param event 
 */
private void keyPressedOnApp(KeyEvent event) {
    Direction direction = new Direction(event.getCode());
    switch (direction.getKey()) {
        case UP:    
            this.keyPressedAnimation(this.UP);
            this.move(direction);
            break;
        case DOWN:  
            this.keyPressedAnimation(this.DOWN);
            this.move(direction);
            break;
        case LEFT:  
            this.keyPressedAnimation(this.LEFT);
            this.move(direction);
            break;
        case RIGHT: 
            this.keyPressedAnimation(this.RIGHT);
            this.move(direction);
            break;
        default:    break;
    }
}
项目:Learning-RxJava    文件:Ch7_17.java   
@Override
    public void start(Stage stage) throws Exception {
        VBox root = new VBox();
        root.setMinSize(200, 100);
        Label typedTextLabel = new Label("");
        root.getChildren().addAll(typedTextLabel);
        Scene scene = new Scene(root);
// Multicast typed keys
        Observable<String> typedLetters =
                JavaFxObservable.eventsOf(scene,
                        KeyEvent.KEY_TYPED)
                        .map(KeyEvent::getCharacter)
                        .share();
// Signal 300 milliseconds of inactivity
        Observable<String> restSignal =
                typedLetters
                        .throttleWithTimeout(500,
                                TimeUnit.MILLISECONDS)
                        .startWith(""); //trigger initial
// switchMap() each period of inactivity to
// an infinite scan() concatenating typed letters
        restSignal.switchMap(s ->
                typedLetters.scan("", (rolling, next) -> rolling +
                        next)
        ).observeOn(JavaFxScheduler.platform())
                .subscribe(s -> {
                    typedTextLabel.setText(s);
                    System.out.println(s);
                });
        stage.setScene(scene);
        stage.show();
    }
项目:AlphaLab    文件:FrmSolicitarReservaHorarioPorRequisito.java   
@FXML
void btnBuscar_onKeyPressed(KeyEvent event) {
    if (event.getCode() == KeyCode.ENTER) {
        if (txtNomeSoftware.getText().equals("")) {
            preencherTableViewRequisitos(software.buscarTodosSoftwares());
        } else {
            preencherTableViewRequisitos(software.buscarPorNome(txtNomeSoftware.getText()));
        }
    }
}
项目:Blindfold    文件:Blindfold.java   
@Override
public void handle(KeyEvent event) {
    if(treeViewTraverser == null) {
        return;
    }
    switch(event.getCode()) {
        case UP:
            label.setText(treeViewTraverser.stepBackward());
            break;
        case DOWN:
            label.setText(treeViewTraverser.stepForward());
            break;
        case LEFT:
            label.setText(treeViewTraverser.stepOut());
            break;
        case RIGHT:
            label.setText(treeViewTraverser.stepIn());
            break;
    }
}
项目:uPMT    文件:MomentExpVBox.java   
private void editNameMode() {
    TextField t = new TextField();
    t.setMaxWidth(180);
    t.setText(moment.getNom());
    t.requestFocus();

    ChangeListener<Boolean>  listener = new ChangeListener<Boolean>() {
         @Override
            public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue)
            {
                if (!newPropertyValue)
                {
                    RenameMomentCommand cmd = new RenameMomentCommand(nameController,moment.getNom(),t.getText());
                    cmd.execute();
                    UndoCollector.INSTANCE.add(cmd);
                    borderPaneLabel.setCenter(label);
                    t.focusedProperty().removeListener(this);
                }
            }
    };
    t.setOnKeyPressed(new EventHandler<KeyEvent>() {

        @Override
        public void handle(KeyEvent event) {
            if(event.getCode() == KeyCode.ENTER){
                t.setText(t.getText());
                borderPaneLabel.setCenter(label);
            }
            if(event.getCode() == KeyCode.ESCAPE){
                borderPaneLabel.setCenter(label);
            }
        }
    });
    t.focusedProperty().addListener(listener);
    Platform.runLater(()->t.requestFocus());
    Platform.runLater(()->t.selectAll());
    borderPaneLabel.setCenter(t);
}
项目:hygene    文件:QuerySettingsController.java   
/**
 * When user finished editing the node id {@link TextField}.
 *
 * @param keyEvent the {@link KeyEvent}
 */
@FXML
void setNodeId(final KeyEvent keyEvent) {
    settings.addRunnable(() -> {
        final TextField source = (TextField) keyEvent.getSource();
        final int newValue = Integer.parseInt(source.getText().replaceAll("[^\\d]", ""));
        graphDimensionsCalculator.getViewPointProperty()
                .set(graphDimensionsCalculator.getGraphProperty().get().getRealStartXPosition(newValue));
    });
}
项目:FYS_T3    文件:homepageController.java   
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
项目:xbrowser    文件:KeyEventHandler.java   
@Override
public void handle(KeyEvent event) {
    String code = event.getCode().getName().toLowerCase();

    if(event.getEventType()==KeyEvent.KEY_PRESSED){
        press.handle(code);
    }else if(event.getEventType()==KeyEvent.KEY_RELEASED){
        release.handle(code);
    }
}
项目:stvs    文件:EditorPaneController.java   
private void filterAltEvents() {

        EventHandler<KeyEvent> handler = e -> {
            if(e.isAltDown()) {
                Event.fireEvent(this.view, e);
            }
        };
        this.view.getCodeArea().setOnKeyPressed(handler);


    }
项目:alchem    文件:AddPurchaseController.java   
public void searchKeyReleaseEvent() {
    search_bill.setOnKeyReleased((KeyEvent keyEvent) -> {
        long bill_no = 0;
        String date = "";
        String whoesaler = "";
        float total_amount = 0;

        ObservableList<Purchase_history> search_bill_data = FXCollections.observableArrayList();

        search_bill_table.setItems(search_bill_data);
        String search = search_bill.getText();

        if (search.equals("")) {
            search_bill_table.setItems(search_bill_table_list);
        } else {
            Iterator<Purchase_history> iterator = search_bill_table_list.iterator();
            while (iterator.hasNext()) {
                Purchase_history temp = iterator.next();
                bill_no = temp.getSearchBillNo();
                if (String.valueOf(bill_no).contains(search)) {
                    whoesaler = temp.getSearchWholesaler();
                    date = temp.getSearchDate();
                    total_amount = temp.getSearchAmount();
                    search_bill_data.add(new Purchase_history(whoesaler,bill_no, date, total_amount));
                }

            }

        }

    });
}
项目:CapsLock    文件:CapsLock.java   
private void  PushKey(KeyEvent event, MainFormController controller) {
    final KeyCode code = event.getCode();
       switch(code){
           case F1:
               System.err.println("F1_Key_Pushed");
               controller.ShufflePanels();
               warning.Stop();
               break;
           default:
               break;
}
   }
项目:fx-animation-editor    文件:SaveDialogComponent.java   
private void initUi() {
    overlay.getStyleClass().add(OVERLAY_STYLE_CLASS);
    showing.addListener((v, o, n) -> onShowingChanged(n));
    mode.addListener((v, o, n) -> onModeChanged(n));
    root.addEventHandler(KeyEvent.KEY_PRESSED, this::onKeyPressed);
    root.visibleProperty().bind(showing);
    root.managedProperty().bind(showing);
    overlay.visibleProperty().bind(showing);
    overlay.managedProperty().bind(showing);
    leftButton.setOnAction(event -> handleSelection(Selection.SAVE));
    middleButton.setOnAction(event -> handleSelection(Selection.CLOSE));
    rightButton.setOnAction(event -> handleSelection(Selection.CANCEL));
    dialogLabel.setGraphic(Svg.WARNING.node());
}
项目:marathonv5    文件:KeyStrokeMotion.java   
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {

        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {

        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
项目:marathonv5    文件:DisplayWindow.java   
/**
 * Initialize the UI for the Main window.
 */
private void initUI() {
    setName("DisplayWindow");

    setWindowState();
    setTheme();
    String projectName = System.getProperty(Constants.PROP_PROJECT_NAME, "");
    if (projectName.equals("")) {
        projectName = "Marathon";
    }
    setTitle(projectName);
    getIcons().add(FXUIUtils.getImageURL("logo16"));
    getIcons().add(FXUIUtils.getImageURL("logo32"));
    getIcons().add(FXUIUtils.getImageURL("logo64"));
    getIcons().add(FXUIUtils.getImageURL("logo128"));
    getIcons().add(FXUIUtils.getImageURL("logo256"));
    workspace = new DockingDesktop("Marathon");
    workspace.addDockableSelectionListener(dockingListener);
    workspace.addDockableStateWillChangeListener(dockingListener);
    workspace.addDockableStateChangeListener(dockingListener);
    ToolBarContainer container = ToolBarContainer.createDefaultContainer(Orientation.LEFT);
    createToolBar(container);
    container.setContent(workspace);
    BorderPane fxBorderPane = new BorderPane(container);
    fxBorderPane.setTop(createMenuBar());
    fxBorderPane.setBottom(statusPanel);
    Scene scene = new Scene(fxBorderPane);
    scene.getStylesheets().add(ModalDialog.class.getClassLoader()
            .getResource("net/sourceforge/marathon/fx/api/css/marathon.css").toExternalForm());
    setScene(scene);
    initStatusBar();
    initDesktop();
    addEventFilter(KeyEvent.KEY_PRESSED, (event) -> {
        if (event.getCode() == KeyCode.F10)
            setFullScreen(true);
    });
    setExitHook();
}
项目:marathonv5    文件:TextAreaReadline.java   
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);
}
项目:jmonkeybuilder    文件:AbstractFileEditor.java   
/**
 * 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();
    }
}
项目:JavaFX-Web-Browser    文件:AutoCompleteTextField.java   
/**
 * Remove autoCompletion listeners from the TextField
 */
public void removeAutoCompletion() {

    // TextChanged Listener
    textField.textProperty().removeListener(textListener);

    // FocusListener
    textField.focusedProperty().removeListener(focusListener);

    //Add keyHandler?
    textField.removeEventHandler(KeyEvent.KEY_RELEASED, keyHandler);
}