List of usage examples for javafx.scene.input MouseEvent getClickCount
public final int getClickCount()
From source file:mesclasses.view.TimetableController.java
private void handleClicks(Pane pane) { pane.setOnMouseClicked((MouseEvent mouseEvent) -> { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { Cours newCours = new Cours(); newCours.setClasse(classes.get(0)); newCours.setDay(paneMap.inverse().get(pane)); newCours.setWeek(config.getProperty(Constants.CONF_WEEK_DEFAULT)); newCours.setStartHour((int) (mouseEvent.getY()) / 60 + 7); newCours.setEndHour(newCours.getStartHour() + 1); createNewCours(newCours); }/*w ww . j av a 2s . c om*/ } }); }
From source file:com.heliosdecompiler.helios.gui.controller.FileTreeController.java
@FXML public void onClickTreeItem(MouseEvent event) { if (event.getClickCount() == 2) { TreeItem<TreeNode> selectedItem = this.root.getSelectionModel().getSelectedItem(); if (selectedItem != null) { if (getParentController().getAllFilesViewerController().handleClick(selectedItem.getValue())) { event.consume();// w w w . j av a2 s . c om } } } }
From source file:account.management.controller.ViewVouchersController.java
@Override public void initialize(URL url, ResourceBundle rb) { new AutoCompleteComboBoxListener<>(select_location); select_location.setOnHiding((e) -> { Location a = select_location.getSelectionModel().getSelectedItem(); select_location.setEditable(false); select_location.getSelectionModel().select(a); });/*from ww w. j a v a 2 s .com*/ select_location.setOnShowing((e) -> { select_location.setEditable(true); }); new AutoCompleteComboBoxListener<>(select_voucher_type); select_voucher_type.setOnHiding((e) -> { VoucherType a = select_voucher_type.getSelectionModel().getSelectedItem(); select_voucher_type.setEditable(false); select_voucher_type.getSelectionModel().select(a); }); select_voucher_type.setOnShowing((e) -> { select_voucher_type.setEditable(true); }); account_list = FXCollections.observableArrayList(); this.account_list = this.getAccounts(); c_id.setCellValueFactory(new PropertyValueFactory("id")); c_date.setCellValueFactory(new PropertyValueFactory("date")); c_location.setCellValueFactory(new PropertyValueFactory("location")); c_narration.setCellValueFactory(new PropertyValueFactory("narration")); c_voucher_type.setCellValueFactory(new PropertyValueFactory("voucher_type")); table.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { try { JSONArray res = Unirest.get(MetaData.baseUrl + "get/voucher/with/date") .queryString("start_date", start_date.getValue().toString()) .queryString("end_date", end_date.getValue().toString()) .queryString("id", table.getSelectionModel().getSelectedItem().getId()).asJson() .getBody().getArray(); Voucher v = table.getSelectionModel().getSelectedItem(); gerReport("VN" + String.format("%03d", Integer.parseInt(v.getId())), v.getDate(), v.getNarration(), v.getVoucher_type(), v.getLocation(), res.toString()); System.out.println(res); } catch (UnirestException ex) { Logger.getLogger(ViewVouchersController.class.getName()).log(Level.SEVERE, null, ex); } } } } }); locations = FXCollections.observableArrayList(); new Thread(() -> { try { HttpResponse<JsonNode> response = Unirest.get(MetaData.baseUrl + "get/locations").asJson(); JSONArray location_array = response.getBody().getArray(); locations.add(new Location(0, "All", "")); for (int i = 0; i < location_array.length() - 1; i++) { String name = location_array.getJSONObject(i).getString("name"); String details = location_array.getJSONObject(i).getString("details"); int id = location_array.getJSONObject(i).getInt("id"); locations.add(new Location(id, name, details)); } select_location.getItems().addAll(locations); } catch (UnirestException ex) { System.out.println("exception in UNIREST"); } }).start(); new Thread(() -> { try { HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "get/voucher/type").asJson(); JSONArray type = res.getBody().getArray(); this.select_voucher_type.getItems().add(new VoucherType(0, "All", "")); for (int i = 0; i < type.length(); i++) { JSONObject obj = type.getJSONObject(i); int id = Integer.parseInt(obj.get("id").toString()); String name = obj.get("type_name").toString(); String note = obj.get("details").toString(); this.select_voucher_type.getItems().add(new VoucherType(id, name, note)); } } catch (UnirestException ex) { Logger.getLogger(NewVoucherController.class.getName()).log(Level.SEVERE, null, ex); } }).start(); }
From source file:photobooth.views.ExplorerPane.java
private BorderPane createImageView(final File imageFile) { // DEFAULT_THUMBNAIL_WIDTH is a constant you need to define // The last two arguments are: preserveRatio, and use smooth (slower) // resizing/*from ww w. ja va 2s . c o m*/ ExplorerPane explorerPane = this; ImageView imageView = null; BorderPane borderPane = new BorderPane(); try { borderPane.setMaxSize(100, 100); borderPane.setMinSize(100, 100); FileInputStream fileInputStream = new FileInputStream(imageFile); final Image image = new Image(fileInputStream, 100, 100, true, true); imageView = new ImageView(image); fileInputStream.close(); imageView.getStyleClass().add("image-view"); borderPane.setCenter(imageView); //imageView.setFitWidth(80); imageView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 1) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ImagePane.getInstance().init(explorerPane, imageFile); Global.getInstance().setSceneRoot(ImagePane.getInstance()); } }).start(); }); } } } }); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } return borderPane; }
From source file:be.makercafe.apps.makerbench.Main.java
/** * Creates the viewer control/*from w w w. j av a2 s . co m*/ * * @return */ private TreeView<String> createViewer() { TreeView<String> viewer = new TreeView<String>(setRootFolder(new File(this.pathMakerbenchHome))); viewer.setMinWidth(200.0); viewer.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); viewer.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getClickCount() == 2) { ResourceTreeItem<String> item = (ResourceTreeItem<String>) viewer.getSelectionModel() .getSelectedItem(); // System.out.println("Selected Text : " + item.getValue()); createEditor(item.getValue(), item.getPath(), null); } else if (mouseEvent.getButton() == MouseButton.SECONDARY) { ResourceTreeItem<String> item = (ResourceTreeItem<String>) viewer.getSelectionModel() .getSelectedItem(); if (item.getPath().toFile().isFile()) { viewer.getContextMenu().getItems().get(0).setDisable(true); viewer.getContextMenu().getItems().get(1).setDisable(true); viewer.getContextMenu().getItems().get(2).setDisable(true); } else { viewer.getContextMenu().getItems().get(0).setDisable(false); viewer.getContextMenu().getItems().get(1).setDisable(false); viewer.getContextMenu().getItems().get(2).setDisable(false); } } } }); viewer.setContextMenu(rootContextMenu); viewer.setEditable(false); viewer.setShowRoot(false); return viewer; }
From source file:com.jscriptive.moneyfx.ui.chart.ChartFrame.java
private void handleMonthlyInOutChartMouseClickEvent(Account account, LocalDate month, MouseEvent event) { if (event.getClickCount() == 2) { TransactionFilter filter = new TransactionFilter(account, null, null, new ValueRange<>(month.withDayOfMonth(1), month.plusMonths(1).withDayOfMonth(1).minusDays(1)), new ValueRange<>(null, null), new ValueRange<>(null, null)); chartFrame.getScene().lookup("#tabPane").fireEvent(new ShowTransactionsEvent(filter)); }/*from w w w .ja v a 2 s . c o m*/ }
From source file:com.jscriptive.moneyfx.ui.chart.ChartFrame.java
private void handleYearlyInOutChartMouseClickEvent(Account account, LocalDate year, MouseEvent event) { if (event.getClickCount() == 2) { TransactionFilter filter = new TransactionFilter(account, null, null, new ValueRange<>(year.withDayOfYear(1), year.withDayOfYear(1).plusYears(1).minusDays(1)), new ValueRange<>(null, null), new ValueRange<>(null, null)); chartFrame.getScene().lookup("#tabPane").fireEvent(new ShowTransactionsEvent(filter)); }//from w w w. j a v a 2s . c o m }
From source file:com.jscriptive.moneyfx.ui.chart.ChartFrame.java
private void handleCategoryChartMouseClickEvent(Account account, Category category, Integer year, MouseEvent event) { if (event.getClickCount() == 2) { TransactionFilter filter = new TransactionFilter(account, category, null, INTEGER_ZERO.equals(year) ? new ValueRange<>(null, null) : new ValueRange<>(of(year, 1, 1), of(year, 12, 31)), new ValueRange<>(null, null), new ValueRange<>(null, null)); chartFrame.getScene().lookup("#tabPane").fireEvent(new ShowTransactionsEvent(filter)); }// w w w. ja v a2 s. c o m }
From source file:benedict.zhang.addon.soundmanager.controller.SoundManagerController.java
public void onSoundSelected(MouseEvent e) { PersistenceManager manager = PersistenceManager.getInstance(); Sound selectItem = (Sound) (this.searchResultTableView.getSelectionModel().getSelectedItem()); if (selectItem == null) { return;//from www .j a v a2s .c o m } Sound selectSound = manager.loadSound(selectItem.getSoundName(), selectItem.getActor()); if (this.getMode().equals(UIViewMode.EDIT)) { if (e.getClickCount() >= 2) { try { SoundDataProxy.getInstance().storeSound(ApplicationUIConstants.SOUND_INFO, selectSound); MapChangeListener<String, Sound> listener = ( MapChangeListener.Change<? extends String, ? extends Sound> change) -> { if (change.wasAdded()) { Sound sound = SoundDataProxy.getInstance() .getDataSound(ApplicationUIConstants.SOUND_INFO, Boolean.TRUE); try { BeanUtils.copyProperties( (Sound) (this.searchResultTableView.getSelectionModel().getSelectedItem()), sound); } catch (IllegalAccessException ex) { Logger.getLogger(SoundManagerController.class.getName()).log(Level.SEVERE, null, ex); } catch (InvocationTargetException ex) { Logger.getLogger(SoundManagerController.class.getName()).log(Level.SEVERE, null, ex); } } }; SoundDataProxy.getInstance().addSoundConfigListener(listener); Stage soundManagerConfigure = SoundManagerConfigureDialog.getSoundManagerDialog(this, display, UIViewMode.READONLY); soundManagerConfigure.showAndWait(); SoundDataProxy.getInstance().removeSoundConfigListener(listener); } catch (IOException ex) { Logger.getLogger(SoundManagerController.class.getName()).log(Level.SEVERE, null, ex); } } } else { if (e.getClickCount() >= 2) { SoundDataProxy.getInstance().storeSound(ApplicationUIConstants.SOUND_INFO, selectSound); display.hide(); } } }
From source file:org.shiftedit.gui.preview.html.RemoteHTMLPreviewController.java
private void setupConnectionTable() { // Cell click handler tableCellMouseEventHandler = (MouseEvent t) -> { TableCell c = (TableCell) t.getSource(); int index = c.getIndex(); // Send ping request on double click if (t.getClickCount() == 2) { tableModel.get(index).ping(); }// w w w . jav a2 s .c o m }; // Cell factory Callback<TableColumn, TableCell> cellFactory = (TableColumn p) -> { TextFieldTableCell cell = new TextFieldTableCell(); cell.addEventFilter(MouseEvent.MOUSE_CLICKED, new WeakEventHandler<>(tableCellMouseEventHandler)); return cell; }; // Remote address TableColumn remoteAddressCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.remote_address")); remoteAddressCol.setMinWidth(100); remoteAddressCol.setCellValueFactory(new PropertyValueFactory<>("remoteAddress")); remoteAddressCol.setCellFactory(cellFactory); connectionTable.getColumns().add(remoteAddressCol); // User agent TableColumn userAgentCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.user_agent")); userAgentCol.setMinWidth(200); userAgentCol.setCellValueFactory(new PropertyValueFactory<>("userAgent")); userAgentCol.setCellFactory(cellFactory); connectionTable.getColumns().add(userAgentCol); // Rendering time TableColumn renderingTimeCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.rendering_time")); renderingTimeCol.setMinWidth(200); renderingTimeCol.setCellValueFactory(new PropertyValueFactory<>("renderingTime")); renderingTimeCol.setCellFactory(cellFactory); connectionTable.getColumns().add(renderingTimeCol); connectionTable.setPlaceholder( new Label(getResourceBundle().getString("builtin.plugin.preview.remote_html.no_connection"))); connectionTable.setItems(tableModel); }