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


Java ImageView类代码示例

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


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

示例1: createGameFileChooserButton

import javafx.scene.image.ImageView; //导入依赖的package包/类
private Button createGameFileChooserButton() {
		Button button = new Button();
		Image image = new Image(NEW_GAME);
		ImageView imageView = new ImageView(image);
		imageView.setFitWidth(App.WIDTH / 3);
		imageView.setPreserveRatio(true);
		button.setGraphic(imageView);
		//button.setWrapText(true);
		button.setOnMouseClicked((e) -> {
			FileLoader fileLoader = new FileLoader(primaryStage);
			File fileChosen = fileLoader.chooseFile();
			if (fileChosen != null) {
				startGame(fileChosen);
			}
		});
//		getRotation(button);
		return button;
	}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:19,代码来源:GameChooser.java

示例2: start

import javafx.scene.image.ImageView; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Digital Clock");
    Group root = new Group();
    Scene scene = new Scene(root, 480, 412);
    // add background image
    ImageView background = new ImageView(new Image(getClass().getResourceAsStream("DigitalClock-background.png")));
    // add digital clock
    clock = new Clock(Color.ORANGERED, Color.rgb(50,50,50));
    clock.setLayoutX(45);
    clock.setLayoutY(186);
    clock.getTransforms().add(new Scale(0.83f, 0.83f, 0, 0));
    // add background and clock to sample
    root.getChildren().addAll(background, clock);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:DigitalClock.java

示例3: ActionTextPane

import javafx.scene.image.ImageView; //导入依赖的package包/类
public ActionTextPane() {

        actionText = new Label("Test");
        graphic = new ImageView(new Image("assets/icons/editor_action_info_icon.png"));
        actionText.setGraphic(graphic);
        actionText.setTextFill(Utils.getDefaultTextColor());
        actionText.setAlignment(Pos.CENTER);
        actionText.setPadding(new Insets(0, 0, 0, 5));
        getChildren().add(actionText);
        setAlignment(Pos.CENTER);

        ft = new FadeTransition(Duration.millis(500), graphic);
        ft.setFromValue(1.0);
        ft.setToValue(0.0);
        ft.setAutoReverse(true);
        ft.setCycleCount(4);

    }
 
开发者ID:jdesive,项目名称:textmd,代码行数:19,代码来源:ActionTextPane.java

示例4: 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

示例5: initialize

import javafx.scene.image.ImageView; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
	nomType.setText(type.getType().getName());
	
	File image = new File("./img/property.png");
	Image icon = new Image(image.toURI().toString());
	this.propertyIcon.setImage(icon);
	
	File imageRename = new File("./img/rename.png");
	Node iconRename = new ImageView(new Image(imageRename.toURI().toString()));
	this.rename.setGraphic(iconRename);
	
	File delete = new File("./img/delete.gif");
	Node iconDelete = new ImageView(new Image(delete.toURI().toString()));
	this.deleteProperty.setGraphic(iconDelete);
	
	Tooltip deletePropertyTip = new Tooltip("Suppression de la propriet�");
	deleteProperty.setTooltip(deletePropertyTip);
	Tooltip renameTip = new Tooltip("Renommer la propriet�");
	rename.setTooltip(renameTip);
	initNumber();
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:23,代码来源:TypeTreeViewControllerProperty.java

示例6: startGame

import javafx.scene.image.ImageView; //导入依赖的package包/类
private void startGame(){
        btStart.setText("刷新");
        answer.setText("");
        showCards.getChildren().clear();
        points1 = new Points1();
        answers = points1.getAnswers();
        imageView = new ImageView[points1.getCardNumber()];
        for (int i = 0; i < imageView.length; i++) {
            imageView[i] = new ImageView();
        }

        //关键
//                Image image = new Image(getClass().getResource("../cards/2.jpg").toExternalForm());//设置图片
//                card2.setImage(image);//设置图片

        for (int i = 0; i < points1.getCardRealNumber().length; i++) {
            Image image = new Image(getClass().getResource(PATH + points1.getCardRealNumber()[i] + SUFFIX).toExternalForm());//设置图片
            imageView[i] = new ImageView(image);
            showCards.getChildren().add(imageView[i]);
        }

    }
 
开发者ID:fankaljead,项目名称:Curriculum-design-of-data-structure,代码行数:23,代码来源:Points2Controller.java

示例7: createEmojiNode

import javafx.scene.image.ImageView; //导入依赖的package包/类
/**
 * 创建emoji图片节点
 *
 * @param emoji
 *            emoji
 * @param size
 *            图片显示大小
 * @param pad
 *            图片间距
 * @param isCursor
 *            是否需要图片光标及鼠标处理事件
 * @return
 */
public static Node createEmojiNode(Emoji emoji, int size, int pad) {
	// 将表情放到stackpane中
	StackPane stackPane = new StackPane();
	stackPane.setMaxSize(size, size);
	stackPane.setPrefSize(size, size);
	stackPane.setMinSize(size, size);
	stackPane.setPadding(new Insets(pad));
	ImageView imageView = new ImageView();
	imageView.setFitWidth(size);
	imageView.setFitHeight(size);
	imageView.setImage(ImageCache.getInstance().getImage(getEmojiImagePath(emoji.getHex())));
	stackPane.getChildren().add(imageView);

	return stackPane;
}
 
开发者ID:Laity000,项目名称:ChatRoom-JavaFX,代码行数:29,代码来源:EmojiDisplayer.java

示例8: ImageToggleButton

import javafx.scene.image.ImageView; //导入依赖的package包/类
public ImageToggleButton(String imageurl) {
	setGraphic(new ImageView(new Image(getClass().getResourceAsStream(imageurl))));
	setStyle(STYLE_NORMAL);

	setOnMousePressed(new EventHandler<MouseEvent>() {
		@Override
		public void handle(MouseEvent event) {
			if (toggle) {
				setStyle(STYLE_NORMAL);
				toggle = false;
			} else {
				setStyle(STYLE_PRESSED);
				toggle = true;
			}
		}
	});
}
 
开发者ID:jasrodis,项目名称:javafx-dataviewer,代码行数:18,代码来源:ImageToggleButton.java

示例9: fillContextMenu

import javafx.scene.image.ImageView; //导入依赖的package包/类
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {

    final Toneg0dParticleInfluencers element = getElement();
    final ParticleEmitterNode emitterNode = element.getEmitterNode();

    final Menu createMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12));
    final ObservableList<MenuItem> createItems = createMenu.getItems();

    CONSTRUCTORS.forEach((type, constructor) -> {
        if (emitterNode.getInfluencer(type) != null) return;
        createItems.add(newInstance(constructor, nodeTree, this));
    });

    items.add(createMenu);

    super.fillContextMenu(nodeTree, items);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:20,代码来源:Toneg0DParticleInfluencersTreeNode.java

示例10: startGame

import javafx.scene.image.ImageView; //导入依赖的package包/类
private void startGame(){
        btStart.setText("刷新");
        showCards.getChildren().clear();
        points1 = new Points1();
        imageView = new ImageView[points1.getCardNumber()];
        for (int i = 0; i < imageView.length; i++) {
            imageView[i] = new ImageView();
        }

        //关键
//                Image image = new Image(getClass().getResource("../cards/2.jpg").toExternalForm());//设置图片
//                card2.setImage(image);//设置图片

        for (int i = 0; i < points1.getCardRealNumber().length; i++) {
            Image image = new Image(getClass().getResource(PATH + points1.getCardRealNumber()[i] + SUFFIX).toExternalForm());//设置图片
            imageView[i] = new ImageView(image);
            showCards.getChildren().add(imageView[i]);
        }

    }
 
开发者ID:fankaljead,项目名称:Curriculum-design-of-data-structure,代码行数:21,代码来源:Points1Controller.java

示例11: forImage

import javafx.scene.image.ImageView; //导入依赖的package包/类
public static final <S> TableCell<S, Image> forImage() {
    final ImageView imageView = new ImageView();
    {
        imageView.setFitWidth(ItemSlot.SLOT_SIZE);
        imageView.setFitHeight(ItemSlot.SLOT_SIZE);
    }
    return new TableCell<S, Image>() {
        @Override
        protected void updateItem(Image item, boolean empty) {
            super.updateItem(item, empty);

            if (empty) {
                setText(null);
                setGraphic(null);
            } else {
                imageView.setImage(item);
                setGraphic(imageView);
            }
        }
    };
}
 
开发者ID:stechy1,项目名称:drd,代码行数:22,代码来源:CellUtils.java

示例12: initSystemSettings

import javafx.scene.image.ImageView; //导入依赖的package包/类
private HBox initSystemSettings() {
	HBox settingBox = new HBox();
	settingBox.setAlignment(Pos.TOP_RIGHT);
	settingBox.setSpacing(15);

	Button musicButton = new Button();
	ImageView musicImageView = new ImageView(
			new Image(getClass().getClassLoader().getResourceAsStream(myResources.getString("music"))));
	musicImageView.setFitWidth(20);
	musicImageView.setPreserveRatio(true);
	musicButton.setGraphic(musicImageView);
	musicButton.setOnMousePressed(e -> {
		// TODO show a menu of several choices of background music
		System.out.println("Here should be a menu of background music choices.");
	});
	settingBox.getChildren().add(musicButton);
	return settingBox;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:19,代码来源:GameManager.java

示例13: rotateHer

import javafx.scene.image.ImageView; //导入依赖的package包/类
public void rotateHer(Label labelHer, ImageView iv)
{
	RotateTransition rotation = new RotateTransition(Duration.seconds(2.3), iv);
	rotation.setCycleCount(Animation.INDEFINITE);
	rotation.setByAngle(360);

	iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
	iv.setRotationAxis(Rotate.Y_AXIS);
	
	labelHer.setOnMouseEntered(e ->
	{ 
		rotation.play();
		iv.setRotate(180);
	});
	labelHer.setOnMouseExited(e ->
	{ 
		rotation.pause();
		iv.setRotate(0);
	});
}
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:21,代码来源:SysSettings.java

示例14: redrawGrid

import javafx.scene.image.ImageView; //导入依赖的package包/类
private void redrawGrid() {
	Map<SpriteMakerModel, Boolean> onScreenOrNot = myModel.getIfTileOnScreen();
	for (SpriteMakerModel sprite : onScreenOrNot.keySet()) {
		if (onScreenOrNot.get(sprite) == false) {
			onScreenOrNot.put(sprite, true);
			for (Component c : sprite.getDeprecatedComponents().values()) {
				if (c.getType().equals(Images.TYPE)) {
					Images imageComponent = (Images) c;
					ImageView imageView = new ImageView(imageComponent.image().getFXImage());
					imageView.setFitHeight(myGrid.getHeight() / myModel.getNumRows());
					imageView.setFitWidth(myGrid.getWidth() / myModel.getNumCols());
					Component possiblePosition = sprite.getComponentByType(Position.TYPE);
					if (possiblePosition != null) {
						Position pos = (Position) possiblePosition;
						GamePoint percentPoint = pos.pos();
						GamePoint gridCoords = getCoordOfMouseHover(percentPoint.x()*getScreenWidth(), percentPoint.y()*getScreenHeight());
						Integer xPos = (int) gridCoords.x();
						Integer yPos = (int) gridCoords.y();
						myGrid.add(imageView, xPos, yPos);
					}
				}
			}
		}			
	}
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:26,代码来源:ScreenMap.java

示例15: rotateHer

import javafx.scene.image.ImageView; //导入依赖的package包/类
public void rotateHer(Label labelHer, ImageView iv)
{
	RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
	rotation.setCycleCount(Animation.INDEFINITE);
	rotation.setByAngle(360);

	iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
	iv.setRotationAxis(Rotate.Y_AXIS);
	
	labelHer.setOnMouseEntered(e ->
	{ 
		rotation.play();
		iv.setRotate(180);
	});
	labelHer.setOnMouseExited(e ->
	{ 
		rotation.pause();
		iv.setRotate(0);
	});
}
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:21,代码来源:MainWindow.java


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