當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.addEventHandler方法代碼示例

本文整理匯總了Java中javafx.scene.image.ImageView.addEventHandler方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.addEventHandler方法的具體用法?Java ImageView.addEventHandler怎麽用?Java ImageView.addEventHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.image.ImageView的用法示例。


在下文中一共展示了ImageView.addEventHandler方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ViewerAboutDialog

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
public ViewerAboutDialog(Stage stage) {
    ImageView image = ImageUtils.createImageView("/icons/spy128.png");
    this.setCenter(image);
    this.setOnMouseClicked(e -> stage.close());

    image.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
        Task<Void> task = new Task<Void>() {
            @Override
            protected Void call() throws Exception {
                Desktop.getDesktop().browse(URI.create(homeUrl));
                return null;
            }
        };
        task.setOnFailed(e -> {
            Throwable exception = e.getSource().getException();
            if (exception != null) {
                Log.error(exception);
                ViewerAlert.exceptionAlert(exception);
            }
        });

        new Thread(task).start();
    });

}
 
開發者ID:Glavo,項目名稱:ClassViewer,代碼行數:26,代碼來源:ViewerAboutDialog.java

示例2: createZoomOutHeatMapEventHandler

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
private static EventHandler<Event> createZoomOutHeatMapEventHandler(ImageView heatMap, Scene scene,
        int originalIndexInParent) {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {
            heatMap.removeEventHandler(MouseEvent.MOUSE_CLICKED, this);

            zoomOutAndReset(heatMap);

            resetToOriginalIndexInParent(heatMap, originalIndexInParent);

            heatMap.addEventHandler(MouseEvent.MOUSE_CLICKED, createZoomInHeatMapEventHandler(heatMap, scene));
        }
    };
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:16,代碼來源:StatsDisplay.java

示例3: createZoomInHeatMapEventHandler

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
private static EventHandler<Event> createZoomInHeatMapEventHandler(ImageView heatMap, Scene scene) {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {
            heatMap.removeEventHandler(MouseEvent.MOUSE_CLICKED, this);

            int originalIndexInParent = getOriginalIndexInParent(heatMap);

            zoomInAndCenter(heatMap, heatMap.getFitWidth(), heatMap.getFitHeight(), true);

            heatMap.addEventHandler(MouseEvent.MOUSE_CLICKED,
                    createZoomOutHeatMapEventHandler(heatMap, scene, originalIndexInParent));
        }
    };
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:16,代碼來源:StatsDisplay.java

示例4: BuildHeatChart

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
public static ImageView BuildHeatChart(Stats stats, Scene scene) {

        HeatMapUtils.buildHeatMap(stats.getHeatMap());

        Image image = new Image("file:" + HeatMapUtils.getHeatMapPath());

        ImageView heatMap = new ImageView(image);
        heatMap.setPreserveRatio(true);

        EventHandler<Event> openHeatMapEvent = createZoomInHeatMapEventHandler(heatMap, scene);

        heatMap.addEventHandler(MouseEvent.MOUSE_CLICKED, openHeatMapEvent);

        return heatMap;
    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:16,代碼來源:StatsDisplay.java


注:本文中的javafx.scene.image.ImageView.addEventHandler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。