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


Java ImageView.setX方法代码示例

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


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

示例1: createIv

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private ImageView createIv(double x, double y) {
	ImageView iv = new ImageView();
	iv.setImage(image);
	iv.setSmooth(true);
	iv.setPickOnBounds(true);
	iv.setCache(true);
	iv.setX(x);
	iv.setY(y);
	iv.setCursor(Cursor.HAND);
	iv.setOnMouseDragged((t) -> {
		ImageView i = (ImageView) (t.getSource());
		i.setX(t.getSceneX()-size/2);
		i.setY(t.getSceneY()-size/2);
	});
	iv.setOnMouseReleased((t) -> {
		double newX = t.getSceneX();
		double newY = t.getSceneY();
		if(zones.isInZone(newX, newY, type)) {
			iv.setVisible(false);
		}
	});
	return iv;
}
 
开发者ID:clonex10100,项目名称:Dna-replication-game,代码行数:24,代码来源:PrimeZoneActivater.java

示例2: execute

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
 * Add an explosion to a pane
 * Creates an explosion from an image and animates it.
 * The explosion removes itself after the animation finishes
 */
@Override
public void execute(Pane pane) {
    ImageView explosionImage = new ImageView(new Image(getClass().getResourceAsStream("/explosion.png")));
    explosionImage.setScaleX(scale);
    explosionImage.setScaleY(scale);
    explosionImage.setX(imageView.getLayoutX() - imageView.getFitWidth() / 2);
    explosionImage.setY(imageView.getLayoutY() - imageView.getFitHeight() / 2);
    SpriteAnimation explosionAnimation = new SpriteAnimation(explosionImage, Duration.millis(1000), 40, 8, 0, 0, 256, 256);
    explosionAnimation.setCycleCount(1);
    explosionAnimation.play();
    pane.getChildren().addAll(explosionImage);

    explosionAnimation.setOnFinished(
            event -> pane.getChildren().remove(explosionImage)
    );
}
 
开发者ID:INAETICS,项目名称:Drones-Simulator,代码行数:22,代码来源:Explosion.java

示例3: DroneImage

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
 * Constructor for Drone Image
 * @param drone2 that the image will represent
 * @param fzView View for displaying drone image
 * @throws FlightZoneException 
 */
public DroneImage(ManagedDrone drone2, FlightZoneView fzView) throws FlightZoneException{
	this.drone = drone2;
	this.fzView = fzView;
	coordTrans = DecimalDegreesToXYConverter.getInstance();
	Point pnt = coordTrans.getPoint(drone2.getLatitude(), drone2.getLongitude());
	
	Image droneImage = new Image("images\\drone.png",50,50,true,true);	
	droneImageView = new ImageView(droneImage);
	droneImageView.setX(pnt.x);
	droneImageView.setY(pnt.y);	
}
 
开发者ID:JaneClelandHuang,项目名称:Dronology,代码行数:18,代码来源:DroneImage.java

示例4: createImageView

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private ImageView createImageView(double posX, double posY, double width, double height,
        @NonNull String imagePath) {
    final Image image = new Image("file:" + imagePath);

    ImageView result = new ImageView(image);
    result.setX(posX);
    result.setY(posY);
    result.setFitWidth(width);
    result.setFitHeight(height);
    result.setPreserveRatio(false);
    return result;
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:13,代码来源:WhereIsIt.java

示例5: RaceTrack

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public RaceTrack() {
    ImageView carImageView = new ImageView(new Image(
            DataAppPreloader.class.getResourceAsStream("images/car.png")));
    road = SVGPathBuilder.create()
            .content(trackPath).fill(null).stroke(Color.gray(0.4))
            .strokeWidth(50)
            .effect(DropShadowBuilder.create().radius(20).blurType(BlurType.ONE_PASS_BOX).build())
            .build();
    SVGPath trackLine = SVGPathBuilder.create()
            .content(trackPath).fill(null).stroke(Color.WHITE)
            .strokeDashArray(8d,6d).build();
    Line startLine = LineBuilder.create()
            .startX(610.312).startY(401.055).endX(610.312).endY(450.838)
            .stroke(Color.WHITE).strokeDashArray(2d,2d).build();
    Text startFinish = TextBuilder.create().text("START/FINISH").fill(Color.WHITE)
            .x(570).y(475).build();
    percentage = TextBuilder.create().text("0%")
            .x(390).y(170).font(Font.font("System", 60))
            .fill(Color.web("#ddf3ff"))
            .stroke(Color.web("#73c0f7"))
            .effect(DropShadowBuilder.create().radius(15).color(Color.web("#3382ba")).blurType(BlurType.ONE_PASS_BOX).build())
            .build();
    ImageView raceCarImg = new ImageView(new Image(
            DataAppPreloader.class.getResourceAsStream("images/Mini-red-and-white.png")));
    raceCarImg.setX(raceCarImg.getImage().getWidth()/2);
    raceCarImg.setY(raceCarImg.getImage().getHeight()/2);
    raceCarImg.setRotate(90);
    raceCar = new Group(raceCarImg);
    
    track = new Group(road, trackLine, startLine, startFinish);
    track.setCache(true);
    // add children
    getChildren().addAll(track, raceCar, percentage);
    
    // Create path animation that we will use to drive the car along the track
    race = new PathTransition(Duration.seconds(1), road, raceCar);
    race.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
    race.play();
    race.pause();
    
    // center our content and set our size
    setTranslateX(-road.getBoundsInLocal().getMinX());
    setTranslateY(-road.getBoundsInLocal().getMinY());
    setPrefSize(road.getBoundsInLocal().getWidth(), road.getBoundsInLocal().getHeight());
    setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:47,代码来源:RaceTrack.java


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