List of usage examples for javafx.scene.input MouseButton PRIMARY
MouseButton PRIMARY
To view the source code for javafx.scene.input MouseButton PRIMARY.
Click Source Link
From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java
@FXML protected void tblTerms_OnMouseClicked(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { this.refreshContexts(); }//from w w w . j a va 2 s. c om }
From source file:eu.over9000.skadi.ui.MainWindow.java
private void setupTable() { this.table = new TableView<>(); this.liveCol = new TableColumn<>("Live"); this.liveCol.setCellValueFactory(p -> p.getValue().onlineProperty()); this.liveCol.setSortType(SortType.DESCENDING); this.liveCol.setCellFactory(p -> new LiveCell()); this.nameCol = new TableColumn<>("Channel"); this.nameCol.setCellValueFactory(p -> p.getValue().nameProperty()); this.titleCol = new TableColumn<>("Status"); this.titleCol.setCellValueFactory(p -> p.getValue().titleProperty()); this.gameCol = new TableColumn<>("Game"); this.gameCol.setCellValueFactory(p -> p.getValue().gameProperty()); this.viewerCol = new TableColumn<>("Viewer"); this.viewerCol.setCellValueFactory(p -> p.getValue().viewerProperty().asObject()); this.viewerCol.setSortType(SortType.DESCENDING); this.viewerCol.setCellFactory(p -> new RightAlignedCell<>()); this.uptimeCol = new TableColumn<>("Uptime"); this.uptimeCol.setCellValueFactory((p) -> p.getValue().uptimeProperty().asObject()); this.uptimeCol.setCellFactory(p -> new UptimeCell()); this.table.setPlaceholder(new Label("no channels added/matching the filters")); this.table.getColumns().add(this.liveCol); this.table.getColumns().add(this.nameCol); this.table.getColumns().add(this.titleCol); this.table.getColumns().add(this.gameCol); this.table.getColumns().add(this.viewerCol); this.table.getColumns().add(this.uptimeCol); this.table.getSortOrder().add(this.liveCol); this.table.getSortOrder().add(this.viewerCol); this.table.getSortOrder().add(this.nameCol); this.filteredChannelList = new FilteredList<>(this.channelHandler.getChannels()); this.sortedChannelList = new SortedList<>(this.filteredChannelList); this.sortedChannelList.comparatorProperty().bind(this.table.comparatorProperty()); this.table.setItems(this.sortedChannelList); this.table.setRowFactory(tv -> { final TableRow<Channel> row = new TableRow<>(); row.setOnMouseClicked(event -> { if ((event.getButton() == MouseButton.PRIMARY) && (event.getClickCount() == 2) && !row.isEmpty()) { this.detailChannel.set(row.getItem()); if (!this.sp.getItems().contains(this.detailPane)) { this.sp.getItems().add(this.detailPane); this.doDetailSlide(true); }//from w ww. j av a 2 s . c o m } }); return row; }); this.table.getSelectionModel().selectedItemProperty().addListener((obs, oldV, newV) -> { this.details.setDisable(newV == null); this.remove.setDisable(newV == null); this.chatAndStreamButton.setDisable(newV == null); this.chatAndStreamButton.resetQualities(); if ((newV == null) && this.sp.getItems().contains(this.detailPane)) { this.doDetailSlide(false); } }); }
From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java
@FXML protected void tblContexts_OnMouseClicked(MouseEvent mouseEvent) throws Exception { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { if (editor != null && arguments != null) { Context context = tblContexts.getSelectionModel().getSelectedItem(); if (context != null) { String argumentString = arguments; argumentString = argumentString.replace("%file", context.getFileName()); argumentString = argumentString.replace("%line", "" + context.getLineNumber()); argumentString = argumentString.replace("%column", "" + context.getColumnNumber()); String command = "\"" + editor + "\"" + argumentString; LOG.debug(command);/*from w w w.j a v a 2 s . c om*/ Runtime.getRuntime().exec(command); } } } } }
From source file:de.bayern.gdi.gui.Controller.java
/** * Handle the service selection button event. * * @param event The mouse click event./* ww w .ja v a 2 s . co m*/ */ @FXML protected void handleServiceSelectButton(MouseEvent event) { if (event.getButton().equals(MouseButton.PRIMARY)) { this.downloadConfig = null; doSelectService(); } }
From source file:ui.main.MainViewController.java
private synchronized void paintReceivedPhotoLoad(Chat chat, File recievedFile, String time) { //this method paints the recieved picture message Task<HBox> recievedMessages = new Task<HBox>() { @Override// w w w . j av a 2 s . c o m protected HBox call() throws Exception { Thread.sleep(100); VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(chatterAvatar.getImage()); //image imageRec.setFitHeight(60); imageRec.setFitWidth(50); String strChatterName = chat.getParticipant(); //add name of the chatter with light color strChatterName = Character.toUpperCase(strChatterName.charAt(0)) + strChatterName.substring(1, strChatterName.indexOf("@")); Label chatterName = new Label(strChatterName); chatterName.setDisable(true); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); try { Image recievedImage = SwingFXUtils.toFXImage(ImageIO.read(recievedFile), null); ImageView receivedImageView = new ImageView(recievedImage); receivedImageView.setFitHeight(300); receivedImageView.setFitWidth(300); receivedImageView.setPreserveRatio(true); receivedImageView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { Desktop dt = Desktop.getDesktop(); try { dt.open(recievedFile); } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } } }); receivedImageView.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.HAND); } }); receivedImageView.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.DEFAULT); } }); vbox.getChildren().addAll(chatterName, receivedImageView, timeL); } catch (IOException e) { e.printStackTrace(); } vbox.setAlignment(Pos.CENTER_RIGHT); HBox hbox = new HBox(); //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER); hbox.getChildren().addAll(imageRec, vbox); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:ui.main.MainViewController.java
private synchronized void paintReceivedPhotoOnTransmit(Chat chat, File recievedFile, String time) { //this method paints the recieved picture message Task<HBox> recievedMessages = new Task<HBox>() { @Override// www. jav a 2s . c o m protected HBox call() throws Exception { VBox vbox = new VBox(); //to add text Thread.sleep(2000); ImageView imageRec = new ImageView(chatterAvatar.getImage()); //image imageRec.setFitHeight(60); imageRec.setFitWidth(50); String strChatterName = chat.getParticipant(); //add name of the chatter with light color strChatterName = Character.toUpperCase(strChatterName.charAt(0)) + strChatterName.substring(1, strChatterName.indexOf("@")); Label chatterName = new Label(strChatterName); chatterName.setDisable(true); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); try { Image recievedImage = SwingFXUtils.toFXImage(ImageIO.read(recievedFile), null); ImageView receivedImageView = new ImageView(recievedImage); receivedImageView.setFitHeight(300); receivedImageView.setFitWidth(300); receivedImageView.setPreserveRatio(true); receivedImageView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { Desktop dt = Desktop.getDesktop(); try { dt.open(recievedFile); } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } } }); receivedImageView.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.HAND); } }); receivedImageView.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.DEFAULT); } }); vbox.getChildren().addAll(chatterName, receivedImageView, timeL); } catch (IOException e) { e.printStackTrace(); } vbox.setAlignment(Pos.CENTER_RIGHT); HBox hbox = new HBox(); hbox.getChildren().addAll(imageRec, vbox); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); //set the received chat message appear on the screen if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); t.start(); } Task t = new Task() { @Override protected Object call() throws Exception { Thread.sleep(2500); return new Object(); } }; t.setOnSucceeded(value -> scrollPane.setVvalue(scrollPane.getHmax())); Thread thread1 = new Thread(t); thread1.start(); }
From source file:ui.main.MainViewController.java
private synchronized void paintReceivedFile(Chat chat, String path, String time) { //this method paints the recieved picture message Task<HBox> recievedMessages = new Task<HBox>() { @Override/*from w ww .j a v a2 s .c om*/ protected HBox call() throws Exception { Thread.sleep(100); VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(chatterAvatar.getImage()); //image imageRec.setFitHeight(60); imageRec.setFitWidth(50); String strChatterName = chat.getParticipant(); //add name of the chatter with light color strChatterName = Character.toUpperCase(strChatterName.charAt(0)) + strChatterName.substring(1, strChatterName.indexOf("@")); Label chatterName = new Label(strChatterName); chatterName.setDisable(true); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); Hyperlink link = new Hyperlink("File Recieved: " + path); link.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<javafx.scene.input.MouseEvent>() { @Override public void handle(javafx.scene.input.MouseEvent event) { try { if (event.getButton() == MouseButton.PRIMARY) { Runtime.getRuntime().exec("explorer.exe /select," + path); } } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }); vbox.getChildren().addAll(chatterName, link, timeL); vbox.setAlignment(Pos.CENTER_RIGHT); HBox hbox = new HBox(); //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER); hbox.getChildren().addAll(imageRec, vbox); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); //t.setDaemon(true); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } //set the received chat message appear on the screen if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); t.start(); } Task t = new Task() { @Override protected Object call() throws Exception { Thread.sleep(2500); return new Object(); } }; t.setOnSucceeded(value -> scrollPane.setVvalue(scrollPane.getHmax())); Thread thread1 = new Thread(t); thread1.start(); }
From source file:ui.main.MainViewController.java
private synchronized void paintSentPhoto(Chat chat, File file, String time) { //this method paints the recieved picture message Task<HBox> recievedMessages = new Task<HBox>() { @Override/*from w w w .jav a 2 s.com*/ protected HBox call() throws Exception { // Thread.sleep(100); VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(myAvatar.getImage()); //image imageRec.setFitHeight(60); imageRec.setFitWidth(50); Label chatterName = new Label(name.getText()); chatterName.setDisable(true); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); try { Image recievedImage = SwingFXUtils.toFXImage(ImageIO.read(file), null); ImageView receivedImageView = new ImageView(recievedImage); receivedImageView.setFitHeight(300); receivedImageView.setFitWidth(300); receivedImageView.setPreserveRatio(true); receivedImageView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { Desktop dt = Desktop.getDesktop(); try { dt.open(file); } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } } }); receivedImageView.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.HAND); } }); receivedImageView.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.DEFAULT); } }); vbox.getChildren().addAll(chatterName, receivedImageView, timeL); } catch (IOException e) { e.printStackTrace(); } vbox.setAlignment(Pos.CENTER_LEFT); HBox hbox = new HBox(); hbox.setAlignment(Pos.CENTER_RIGHT); //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER); hbox.getChildren().addAll(vbox, imageRec); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:ui.main.MainViewController.java
private synchronized void paintSentFile(Chat chat, String path, String time) { //this method paints the recieved picture message Task<HBox> recievedMessages = new Task<HBox>() { @Override/*w w w . j a v a2 s .com*/ protected HBox call() throws Exception { Thread.sleep(100); VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(myAvatar.getImage()); //image imageRec.setFitHeight(60); imageRec.setFitWidth(50); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); Label chatterName = new Label(name.getText()); chatterName.setDisable(true); Hyperlink link = new Hyperlink("File Sent: " + path); link.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<javafx.scene.input.MouseEvent>() { @Override public void handle(javafx.scene.input.MouseEvent event) { try { if (event.getButton() == MouseButton.PRIMARY) { Runtime.getRuntime().exec("explorer.exe /select," + path); } } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }); vbox.getChildren().addAll(chatterName, link, timeL); vbox.setAlignment(Pos.CENTER_LEFT); HBox hbox = new HBox(); hbox.setAlignment(Pos.CENTER_RIGHT); //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER); hbox.getChildren().addAll(vbox, imageRec); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:editeurpanovisu.EditeurPanovisu.java
private void gereSourisPanoramique(MouseEvent me) { if (me.getButton() == MouseButton.SECONDARY) { if (me.isShiftDown()) { panoChoixNord(me.getSceneX() - imagePanoramique.getLayoutX()); me.consume();/*from w ww.j a v a2 s . c o m*/ } else if (me.isControlDown()) { } else { panoChoixRegard(me.getSceneX() - imagePanoramique.getLayoutX(), me.getSceneY()); me.consume(); } } if (me.getButton() == MouseButton.PRIMARY) { if (me.isShiftDown()) { if (!me.isControlDown()) { if (!dragDrop) { panoAjouteImage(me.getSceneX() - imagePanoramique.getLayoutX(), me.getSceneY()); } else { dragDrop = false; } } else { } } else if (!(me.isControlDown()) && estCharge) { if (!dragDrop) { panoMouseClic(me.getSceneX() - imagePanoramique.getLayoutX(), me.getSceneY()); } else { dragDrop = false; } } } }