当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.setOnMouseClicked方法代码示例

本文整理汇总了Java中javafx.scene.image.ImageView.setOnMouseClicked方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setOnMouseClicked方法的具体用法?Java ImageView.setOnMouseClicked怎么用?Java ImageView.setOnMouseClicked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.image.ImageView的用法示例。


在下文中一共展示了ImageView.setOnMouseClicked方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initData

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
public void initData(Parent node, Map<String, String> bundle) {
	progressbar = (ProgressIndicator) node.lookup("#progressbar");

	iv_sync = (ImageView) node.lookup("#iv_sync");
	iv_down = (ImageView) node.lookup("#iv_down");

	iv_sync.setOnMouseEntered(e-> {
		iv_sync.setImage(sync_enter);
	});
	iv_sync.setOnMouseExited(e-> {
		iv_sync.setImage(sync_defalt);
	});

	iv_down.setOnMouseEntered(e-> {
		iv_down.setImage(down_enter);
	});
	iv_down.setOnMouseExited(e-> {
		iv_down.setImage(down_default);
	});

	iv_down.setOnMouseClicked(e->{
		 download();
	});

	iv_sync.setOnMouseClicked(e->{
		sync();
	});
}
 
开发者ID:coding-dream,项目名称:Notebook,代码行数:30,代码来源:SyncFragment.java

示例2: setImages

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void setImages(List<Image> images, ImageClickHandler handler) throws IOException {
        grid.clear();
        for (Image image : images) {
            ImageView imageView = grid.addImage(image.getThumbnailPath());

            if(imageView == null)
                continue;

//            toolTipProvider.setToolTip(imageView, image);
            toolTipProvider.setPopOver(imageView, image);

            imageView.setOnMouseClicked(eventHandlerFactory.createFrom(image, handler));

            imageView.setOnMouseEntered(event -> getScene().setCursor(Cursor.HAND));
            imageView.setOnMouseExited(event -> getScene().setCursor(Cursor.DEFAULT));

        }
    }
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:19,代码来源:CollectionGrid.java

示例3: showQRCode

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@FXML
protected void showQRCode(MouseEvent event) {
    // Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
    // lazy tonight.
    final byte[] imageBytes = QRCode
            .from(uri())
            .withSize(320, 240)
            .to(ImageType.PNG)
            .stream()
            .toByteArray();
    Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
    ImageView view = new ImageView(qrImage);
    view.setEffect(new DropShadow());
    // Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
    // Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
    // non-centered on the screen. Finally fade/blur it in.
    Pane pane = new Pane(view);
    pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
    final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
    view.setOnMouseClicked(event1 -> overlay.done());
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:22,代码来源:ClickableBitcoinAddress.java

示例4: start

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    ImageView demo1Button = new ImageView();
    ImageView demo2Button = new ImageView();

    demo1Button.setFitWidth(200);
    demo2Button.setFitWidth(200);

    demo1Button.setPreserveRatio(true);
    demo2Button.setPreserveRatio(true);

    HBox.setHgrow(demo1Button, Priority.ALWAYS);
    HBox.setHgrow(demo2Button, Priority.ALWAYS);


    demo1Button.getStyleClass().add("demo1");
    demo2Button.getStyleClass().add("demo2");

    demo1Button.setOnMouseClicked(evt -> showDemo1());
    demo2Button.setOnMouseClicked(evt -> showDemo2());

    HBox container = new HBox(demo1Button, demo2Button);

    Scene scene = new Scene(container);
    scene.getStylesheets().add(MovieApp.class.getResource("/chooser.css").toExternalForm());
    scene.getStylesheets().add(MovieApp.class.getResource("/fonts.css").toExternalForm());

    primaryStage.setResizable(false);
    primaryStage.setTitle("Extreme GUI Makeover");
    primaryStage.setScene(scene);
    primaryStage.sizeToScene();
    primaryStage.setX(50);
    primaryStage.setY(100);
    primaryStage.show();
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:36,代码来源:MovieApp.java

示例5: getMonstersOnScreen

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void getMonstersOnScreen() {
	List<SpriteMakerModel> allSprites = new ArrayList<SpriteMakerModel>(myData.getSprites());
	List<SpriteMakerModel> onlyMonsters = new ArrayList<>();
	for (SpriteMakerModel possibleMonster : allSprites) {
		if (isMonster(possibleMonster)) {
			onlyMonsters.add(possibleMonster);
		}
	}
	for (SpriteMakerModel monster : onlyMonsters) {
		Images imageComp = (Images) monster.getComponentByType(Images.TYPE);
		ImageView iv = new ImageView(imageComp.image().getFXImage());
		iv.setFitWidth(100);
		iv.setFitHeight(100);
		iv.setOnMouseClicked(click -> {
			setCurrentMonster(monster, new ImageView(imageComp.image().getFXImage()));
			mySpawnerInfo.setCurrentMonsterToSpawn(monster);
		});
		monsterImages.getChildren().add(iv);
	}
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:21,代码来源:AllPossibleMonsters.java

示例6: render

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void render(List<Skill> newSkills) {
	if (sameSkills(oldSkills, newSkills)) {return;}
	oldSkills = newSkills;
	box.getChildren().clear();
	for (Skill skill: newSkills) {
		if (skill.getIcon().isPresent()) {
			ImageView skillImageView = new ImageView(skill.getIcon().get().getFXImage());
			skillImageView.setFitWidth(skill.getIcon().get().width());
			skillImageView.setFitHeight(skill.getIcon().get().height());
			skillImageView.setOnMouseClicked(e -> {
				bus.emit(new SelectSkillEvent(SelectSkillEvent.SELECT, skill));
			});
			box.getChildren().add(skillImageView);
		}			
	}
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:17,代码来源:SkillBox.java

示例7: newDir2

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void newDir2() {
    int j = 0; // Used to properly insert to grid when there are files other than an image
    for (int i=0; i<fileList.length; i++) {
        String path = "" + fileList[i];
        if (fileList[i].getName().contains(".png") || fileList[i].getName().contains(".jpg")||
            fileList[i].getName().contains(".gif") || fileList[i].getName().contains(".jpeg")) {
            String title = "" + fileList[i];
            pth = new Image("file://" + fileList[i]);
            ImageView view = (ImageView) (tilePane.getChildren().get(j));

            view.setImage(pth);
            view.setCache(true);
								    final ImageView imgViewPoped =  new ImageView("file://" + fileList[i]);
            // image click actions
            view.setOnMouseClicked(mouse -> {
                MouseButton button = mouse.getButton();
				            if (mouse.getClickCount() == 2 && button == MouseButton.PRIMARY && !mouse.isConsumed()) {
				                mouse.consume();
                    txtDirPath.setText(path);
                    settings.setBackgroundInfo(path);
   								     } else if (button == MouseButton.SECONDARY) {
			                 displayImg(imgViewPoped, title);
                }
            });
            j++;
				    } else {
               System.out.println("Not an image file.");
        }
    }
}
 
开发者ID:maximstewart,项目名称:UDE,代码行数:31,代码来源:BackgroundMngrController.java

示例8: MapCreatorView

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
 * Build the CreatorView from existing Map in the DB
 */
public MapCreatorView(MapController controller, fr.iut.persistence.entities.Map mapInBdd) {
    this(controller);
    this.mapInBdd = mapInBdd;

    //We create the image from bytes in DB
    Image image = new Image(new ByteArrayInputStream(mapInBdd.getImage()));

    buttonReset.setVisible(true);

    adaptMapPaneToImage(image);


    //We create the spots on the map from the DB
    for(Spot spot : controller.getAllSpots()) {

        ItemMap correspondingItem = null;

        for(ItemMap itemMap : availableItems)
            if(itemMap.getType().equals(spot.getSpotType())) {
                correspondingItem = itemMap;
                break;
            }

        if(correspondingItem == null) {
            System.out.println("This cannot be possible !!!");
            System.exit(1);
        }

        ImageView imageOnMap = new ImageView(correspondingItem.getSmallImage());
        mapPane.getChildren().add(imageOnMap);
        imageOnMap.setTranslateX(spot.getPointX());
        imageOnMap.setTranslateY(spot.getPointY());

        ItemMap finalCorrespondingItem = correspondingItem;
        imageOnMap.setOnMouseClicked(mouseEvent1 -> {
            editItem(new ImageView(finalCorrespondingItem.getBigImage()), imageOnMap, spot);
        });
    }
}
 
开发者ID:Moccko,项目名称:campingsimulator2017,代码行数:43,代码来源:MapCreatorView.java

示例9: loadFromFile

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void loadFromFile(SpriteMakerModel monster) {
	if (isMonster(monster)) {
		Images imageComp = (Images) monster.getComponentByType(Images.TYPE);
		ImageView iv = new ImageView(imageComp.image().getFXImage());
		iv.setFitWidth(IMAGE_SIZE);
		iv.setFitHeight(IMAGE_SIZE);
		iv.setOnMouseClicked(click -> {
			setCurrentMonster(monster, new ImageView(imageComp.image().getFXImage()));
			mySpawnerInfo.setCurrentMonsterToSpawn(monster);
		});
		monsterImages.getChildren().add(iv);
	}
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:14,代码来源:AllPossibleMonsters.java

示例10: startCameraEdges

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void startCameraEdges(final ImageView imageViewForOpenCV) {
    // preserve image ratio
    imageViewForOpenCV.setPreserveRatio(true);

    // mouse listener
    imageViewForOpenCV.setOnMouseClicked(e -> {
        LOGGER.info("[" + e.getX() + ", " + e.getY() + "]");
        clickedPoint.x = e.getX();
        clickedPoint.y = e.getY();
    });

    if (!isCameraActive) {
        // disable setting checkboxes
        this.canny.setDisable(true);
        this.dilateErode.setDisable(true);

        // start the video capture
        VIDEO_CAPTURE.open(0);

        // is the video stream available?
        if (VIDEO_CAPTURE.isOpened()) {
            isCameraActive = true;

            // grab a frame every 33 ms (30 frames/sec)
            Runnable frameGrabber = () -> {
                // effectively grab and process a single frame
                Mat frame = grabFrameEdges();
                // convert and show the frame
                Image imageToShow = UtilsOpenCV.mat2Image(frame);
                updateImageView(imageViewForOpenCV, imageToShow);
            };

            timer = Executors.newSingleThreadScheduledExecutor();
            timer.scheduleAtFixedRate(frameGrabber, 0, 33, TimeUnit.MILLISECONDS);

            // update the button content
            btnOpenCVStartCamera.setText("Stop Camera");
        } else {
            // log the error
            LOGGER.error("Failed to open the camera connection...");
        }
    } else {
        // the camera is not active at this point
        isCameraActive = false;
        // update again the button content
        btnOpenCVStartCamera.setText("Start Camera");
        // enable setting checkboxes
        canny.setDisable(false);
        dilateErode.setDisable(false);

        // stop the timer
        this.stopAcquisition();
    }
}
 
开发者ID:Evegen55,项目名称:main_carauto_board,代码行数:55,代码来源:MagicTabController.java


注:本文中的javafx.scene.image.ImageView.setOnMouseClicked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。