当前位置: 首页>>代码示例>>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;未经允许,请勿转载。