當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。