本文整理汇总了Java中javafx.scene.image.ImageView.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setImage方法的具体用法?Java ImageView.setImage怎么用?Java ImageView.setImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.setImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reload
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
* Reload.
*/
protected void reload() {
final ImageChannelPreview textureTooltip = getTextureTooltip();
final Label textureLabel = getTextureLabel();
final ImageView preview = getTexturePreview();
final Path textureFile = getTextureFile();
if (textureFile == null) {
textureLabel.setText(Messages.MATERIAL_MODEL_PROPERTY_CONTROL_NO_TEXTURE);
preview.setImage(null);
textureTooltip.clean();
return;
}
final Path assetFile = notNull(getAssetFile(textureFile));
textureLabel.setText(assetFile.toString());
preview.setImage(IMAGE_MANAGER.getImagePreview(textureFile, 28, 28));
textureTooltip.showImage(textureFile);
}
示例2: InferenceRuleView
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
* Adds the content for showing the inference rules to the TabPane in the proof
* @param tabPane
*
*/
public InferenceRuleView(TabPane tabPane) {
//load the image
Image image = new Image("inferenceRules.png");
ImageView iv1 = new ImageView();
iv1.setImage(image);
iv1.setSmooth(true);
iv1.setPreserveRatio(true);
//putting the image on a scrollpane
ScrollPane sp=new ScrollPane();
sp.getStyleClass().add("rulesView");
tab = new ViewTab("Inference Rules",this);
sp.setContent(iv1);
tabPane.getTabs().add(tab);
tab.setContent(sp);
tabPane.getSelectionModel().select(tab);
//used for getting screensize
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//Avoids scaling too much
double w=primaryScreenBounds.getWidth()/2;
iv1.setFitWidth(w);
}
示例3: 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;
}
示例4: ContentPaneButton
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public ContentPaneButton(String imageName, ButtonDisplay buttonDisplay) {
super("CURSE_META_PANE");
ImageView imageView = new ImageView();
if (imageName != null && !imageName.isEmpty()) {
Image image = ImageUtil.openCachedImage(FileUtil.getResourceStream("images/" + imageName), imageName);
if (image != null)
imageView.setImage(image);
setGraphic(imageView);
}
setAlignment(Pos.CENTER_LEFT);
setPrefHeight(50);
setFocusTraversable(false);
setId("oc-panel-button");
this.buttonDisplay = buttonDisplay;
}
示例5: selectAction
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@FXML
protected void selectAction(MouseEvent e){
String source1 = e.getSource().toString(); //yields complete string
String source2 = e.getPickResult().getIntersectedNode().getId(); //获取点击的节点id returns JUST the id of the object that was clicked
imageView = (ImageView) (showCoins.getScene().lookup("#" + source2));
if(inputFormCoins[Integer.valueOf(source2)] == 'H'){
imageView.setImage(new Image(getClass().getResource(PATH + 'T' + SUFFIX).toExternalForm()));
inputFormCoins[Integer.valueOf(source2)] = 'T';
}else {
imageView.setImage(new Image(getClass().getResource(PATH + 'H' + SUFFIX).toExternalForm()));
inputFormCoins[Integer.valueOf(source2)] = 'H';
}
tailGame = new TailGame(this.rowNum, this.columnNum);
}
示例6: 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);
}
}
};
}
示例7: buildItemCell
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private Node buildItemCell(SocialMediaItem item) {
HBox hbox = new HBox();
InputStream resource = item.getClass().getResourceAsStream("icon.png");
if (resource != null) {
ImageView sourceImage = new ImageView();
sourceImage.setFitHeight(18);
sourceImage.setPreserveRatio(true);
sourceImage.setSmooth(true);
sourceImage.setCache(true);
sourceImage.setImage(new Image(resource));
hbox.getChildren().add(sourceImage);
}
if (item.getImage() != null) {
HBox picture = new HBox();
picture.setPadding(new Insets(0, 10, 0, 0));
ImageView imageView = new ImageView(item.getImage());
imageView.setPreserveRatio(true);
imageView.setFitWidth(150);
picture.getChildren().add(imageView);
hbox.getChildren().add(picture);
}
Label text = new Label(item.getBody());
text.setFont(Font.font(null, 20));
text.setWrapText(true);
hbox.getChildren().add(text);
return hbox;
}
示例8: validate
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
@FXThread
protected boolean validate(@NotNull final VarTable vars) {
final ImageView imageView = getImageView();
if (!vars.has(PROP_FILE)) {
imageView.setImage(null);
return false;
}
final Path file = vars.get(PROP_FILE);
if (!JMEFilePreviewManager.isModelFile(file)) {
imageView.setImage(null);
return false;
}
final Path renderedFile = getRenderedFile();
if (renderedFile != null && file.equals(renderedFile)) {
return super.validate(vars);
}
final int width = (int) imageView.getFitWidth();
final int height = (int) imageView.getFitHeight();
final JMEFilePreviewManager previewManager = JMEFilePreviewManager.getInstance();
previewManager.showExternal(file, width, height);
final ImageView sourceView = previewManager.getImageView();
final ObjectProperty<Image> imageProperty = imageView.imageProperty();
imageProperty.bind(sourceView.imageProperty());
setRenderedFile(file);
return super.validate(vars);
}
示例9: configureBackground
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void configureBackground() {
ImageView imageView = new ImageView();
Image image = loadImage();
imageView.setImage(image);
Circle circle1 = new Circle();
circle1.setCenterX(140);
circle1.setCenterY(140);
circle1.setRadius(120);
circle1.setFill(Color.TRANSPARENT);
circle1.setStroke(Color.web("#0A0A0A"));
circle1.setStrokeWidth(0.3);
Circle circle2 = new Circle();
circle2.setCenterX(140);
circle2.setCenterY(140);
circle2.setRadius(118);
circle2.setFill(Color.TRANSPARENT);
circle2.setStroke(Color.web("#0A0A0A"));
circle2.setStrokeWidth(0.3);
Circle circle3 = new Circle();
circle3.setCenterX(140);
circle3.setCenterY(140);
circle3.setRadius(140);
circle3.setFill(Color.TRANSPARENT);
circle3.setStroke(Color.web("#818a89"));
circle3.setStrokeWidth(1);
Ellipse ellipse = new Ellipse(140, 95, 180, 95);
Circle ellipseClip = new Circle(140, 140, 140);
ellipse.setFill(Color.web("#535450"));
ellipse.setStrokeWidth(0);
GaussianBlur ellipseEffect = new GaussianBlur();
ellipseEffect.setRadius(10);
ellipse.setEffect(ellipseEffect);
ellipse.setOpacity(0.1);
ellipse.setClip(ellipseClip);
background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
示例10: configureImage
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private BorderPane configureImage(String url) {
Image image = new Image(url);
ImageView imageView = new ImageView();
imageView.setImage(image);
BorderPane pane = new BorderPane();
pane.setCenter(imageView);
return pane;
}
示例11: Bonus
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public Bonus(int type) {
content = new ImageView();
getChildren().add(content);
this.type = type;
Image image = Config.getBonusesImages().get(type);
width = (int)image.getWidth() - Config.SHADOW_WIDTH;
height = (int)image.getHeight() - Config.SHADOW_HEIGHT;
content.setImage(image);
setMouseTransparent(true);
}
示例12: setPlayersInformation
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void setPlayersInformation(Player p, Label playerLabel) {
FlowPane playerPane = (FlowPane) playerLabel.getParent();
if (playerPane.getChildren().size() == 2) {
playerPane.getChildren().remove(0);
}
Image img = new Image("resources/player/" + p.getColor() + ".png");
ImageView iv = new ImageView();
iv.setFitWidth(30.0);
iv.setPreserveRatio(true);
iv.setImage(img);
playerLabel.setText("Joueur " + p.getColor() + " > Ressources : " + p.getResources()
+ " | Nombre de Yacks : " + p.getEconomicScore());
playerPane.getChildren().add(0, iv);
}
示例13: wrapTheirMessage
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void wrapTheirMessage(Message message) {
HBox hbox = new HBox();
ImageView thumbNail = new ImageView();
thumbNail.prefWidth(65);
thumbNail.setPreserveRatio(true);
thumbNail.setFitHeight(65);
thumbNail.setImage(new Image(ConversationService.getInstance()
.getParticipantThumbnail(message.getAddress())));
hbox.getChildren().add(thumbNail);
createMessageBox(message, hbox, Pos.TOP_LEFT);
setGraphic(hbox);
}
示例14: show
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
@FXThread
public void show(@NotNull final Path file) {
super.show(file);
final ImageView imageView = getGraphicsNode();
final int width = (int) imageView.getFitWidth();
final int height = (int) imageView.getFitHeight();
imageView.setImage(JAVA_FX_IMAGE_MANAGER.getImagePreview(file, width, height));
}
示例15: Bat
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public Bat() {
height = (int)CENTER.getHeight() - Config.SHADOW_HEIGHT;
Group group = new Group();
leftImageView = new ImageView();
leftImageView.setImage(LEFT);
centerImageView = new ImageView();
centerImageView.setImage(CENTER);
centerImageView.setTranslateX(LEFT.getWidth());
rightImageView = new ImageView();
rightImageView.setImage(RIGHT);
changeSize(DEFAULT_SIZE);
group.getChildren().addAll(leftImageView, centerImageView, rightImageView);
getChildren().add(group);
setMouseTransparent(true);
}