List of usage examples for javafx.scene.input KeyCode ENTER
KeyCode ENTER
To view the source code for javafx.scene.input KeyCode ENTER.
Click Source Link
From source file:de.unibw.inf2.fishification.FishWorld.java
private void registerKeys() { getWorldCanvas().setOnKeyPressed(new EventHandler<KeyEvent>() { @Override/*from w w w . j av a2s . c o m*/ public void handle(KeyEvent keyEvent) { if (keyEvent.getCode().equals(KeyCode.DIGIT1)) { toggleFps(); } else if (keyEvent.getCode().equals(KeyCode.DIGIT2)) { toggleBackground(); } else if (keyEvent.getCode().equals(KeyCode.DIGIT3)) { toggleWaveEffect(); } else if (keyEvent.getCode().equals(KeyCode.DIGIT0)) { asyncTakeScreenshot(); } else if (keyEvent.getCode().equals(KeyCode.ENTER)) { feedFish("all"); } else if (keyEvent.getCode().equals(KeyCode.SPACE)) { togglePause(); } } }); }
From source file:de.ks.idnadrev.information.chart.ChartDataEditor.java
private EventHandler<KeyEvent> getInputKeyHandler(int rowNum, int column, BiFunction<Integer, Integer, TextField> nextTextField, BiConsumer<Integer, Integer> clipBoardHandler) { return e -> { KeyCode code = e.getCode();/*from w w w. j a va 2 s . c om*/ if (e.isControlDown() && code == KeyCode.V) { clipBoardHandler.accept(rowNum, column); e.consume(); } boolean selectNext = false; if (e.getCode() == KeyCode.ENTER && !e.isControlDown()) { selectNext = true; } if (selectNext) { int next = rowNum + 1; TextField textField = nextTextField.apply(next, column); if (textField != null) { textField.requestFocus(); } e.consume(); } }; }
From source file:Jigs_Desktop_Client.GUI.FXMLDocumentController.java
@Override public void initialize(URL url, ResourceBundle rb) { this.alert("resources/app_launch.mp3"); this.user_name.requestFocus(); this.btn_logout.setDisable(true); this.jc.setStatus(from_user, "online"); this.my_circle_list.setCellFactory(new Callback<ListView<UserStatus>, ListCell<UserStatus>>() { @Override/*www . j av a 2 s .co m*/ public ListCell<UserStatus> call(ListView<UserStatus> userObj) { ListCell<UserStatus> cell = new ListCell<UserStatus>() { @Override protected void updateItem(UserStatus usrObj, boolean btnl) { super.updateItem(usrObj, btnl); if (usrObj != null) { String filename = usrObj.getStatus(); if (filename == null || filename.equals("") || filename.equals("null")) filename = "offline"; else System.out.println(filename); Image img = new Image( getClass().getResource("resources/" + filename + ".png").toExternalForm()); ImageView imv = new ImageView(img); setGraphic(imv); setText(usrObj.getUsername()); } } }; return cell; } }); this.main_panel.setBackground(Background.EMPTY); this.text_message.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent keyEvent) { if (keyEvent.getCode() == KeyCode.ENTER) { sendMessage(null); keyEvent.consume(); } } }); }
From source file:com.esri.geoevent.test.performance.ui.FixtureController.java
@FXML public void onNameFieldKeyPressed(final KeyEvent event) { if (event.getCode() == KeyCode.ENTER) { setEditNameState(!isEditingName); } }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
protected void setupKeyHandler(Scene scene) { if (!hideCloseButton) { scene.setOnKeyPressed(e -> {// ww w . j a v a 2 s . c om if (e.getCode() == KeyCode.ESCAPE || e.getCode() == KeyCode.ENTER) { e.consume(); doClose(); } }); } }
From source file:com.esri.geoevent.test.performance.ui.FixtureController.java
@FXML public void onAddProducerKeyPressed(final KeyEvent event) { if (event.getCode() == KeyCode.ENTER) { ActionEvent actionEvent = null; addProducer(actionEvent);/*from ww w . j a v a 2 s .c o m*/ } }
From source file:view.FXApplicationController.java
@Override public void initialize(URL arg0, ResourceBundle arg1) { System.out.println("initialize called"); overlay3.addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() { @Override/*ww w. java 2 s . c o m*/ public void handle(MouseEvent mouse) { mouseX.set(mouse.getX()); mouseY.set(mouse.getY()); if (kComplexFlag) { if (mouse.getEventType() == MouseEvent.MOUSE_PRESSED) { Line line = new Line(); line.setStyle("-fx-stroke: red;"); overlay3.getChildren().add(line); line.setStartX(0); line.setStartY(0); line.setLayoutX(mouseX.get()); line.setLayoutY(mouseY.get()); lines.add(line); } if (mouse.isPrimaryButtonDown() && (!lines.isEmpty())) { Line line = lines.getLast(); double endXPos = mouseX.get() - line.getLayoutX(); double endYPos = mouseY.get() - line.getLayoutY(); line.setEndX(endXPos); line.setEndY(endYPos); calculatePercentageKComplex(); } } if (help1Flag) { double offsetSize = 1. / (activeChannels.size() + 1.); double posOnOverlay = mouse.getY(); double zoom = 1.0; for (int i = 0; i < activeChannels.size(); i++) { double realOffset = (1 - (i + 1.) * offsetSize); double upperBound = yAxis.getDisplayPosition( (realOffset - offsetSize / 2.) * yAxis.getUpperBound()) + yAxis.getLayoutY(); double lowerBound = yAxis.getDisplayPosition( (realOffset + offsetSize / 2.) * yAxis.getUpperBound()) + yAxis.getLayoutY(); if ((posOnOverlay <= upperBound) && (posOnOverlay > lowerBound)) { zoom = getZoomFromChannel(activeChannels.get(i)); } } space.set(75.0 * zoom / yAxis.getUpperBound() * yAxis.getHeight()); line1.setVisible(true); line2.setVisible(true); } else { line1.setVisible(false); line2.setVisible(false); } } }); //Key Listener lineChart.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { keyAction(ke); } }); toolBarGoto.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { if (ke.getCode() == KeyCode.ENTER) { int valueTextField = -1; try { valueTextField = Integer.parseInt(toolBarGoto.getText()); } catch (NumberFormatException e) { toolBarGoto.setText((currentEpoch + 1) + ""); valueTextField = currentEpoch + 1; Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Error during handling enter key.", e); } if (valueTextField > dataModel.getNumberOf30sEpochs()) { valueTextField = dataModel.getNumberOf30sEpochs(); } else if (valueTextField < 1) { valueTextField = 1; } currentEpoch = valueTextField - 1; goToEpoch(currentEpoch); if (kComplexFlag) { calculatePercentageKComplex(); } } } }); choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { System.out.println(newValue); if (newValue != null) { featureModel.setFeatureChannel(Arrays.asList(channelNames).indexOf(newValue)); System.out.println("########" + Arrays.asList(channelNames).indexOf(newValue)); System.out.println(featureModel.getFeatureChannel()); featureModel.setTsneComputed(false); featureModel.setFeaturesComputed(false); featureModel.setClassificationDone(false); featureModel.setReadinDone(false); classifyButton.setDisable(false); recompute = true; if (viewModel.isKcMarkersActive()) { computeKCfeatures(); } else { overlay4.getChildren().clear(); } } } }); choiceBoxModel.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { classifier = classifierList.get(newValue.intValue()); System.out.println(classifier); featureModel.setClassificationDone(false); featureModel.setReadinDone(false); classifyButton.setDisable(false); recompute = true; } }); primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { System.out.println("RandomAccessFile closed"); dataModel.getReader().close(); Platform.exit(); } }); kComplexOnAction(); help1OnAction(); }
From source file:com.esri.geoevent.test.performance.ui.FixtureController.java
@FXML public void onAddConsumerKeyPressed(final KeyEvent event) { if (event.getCode() == KeyCode.ENTER) { ActionEvent actionEvent = null; addConsumer(actionEvent);//from www . j a va2 s . c om } }
From source file:genrsa.GenRSAController.java
/** * Mtodo usado cuando se pulsa enter al meter los bits de generar de manera automtica una clave * @param keyEvent//from w w w .j av a 2 s . c o m */ public void processAutomaticGeneration2(KeyEvent keyEvent) { if (keyEvent.getCode() == KeyCode.ENTER) { processAutomaticGeneration(new ActionEvent()); } }
From source file:genrsa.GenRSAController.java
/** * Mtodo usado cuando se pulsa enter al meter los primos p y q o la clave pblica * @param keyEvent/*from w ww .j a va 2 s . co m*/ */ public void processManualGeneration2(KeyEvent keyEvent) { if (keyEvent.getCode() == KeyCode.ENTER) { this.processManualGeneration(new ActionEvent()); } }