javafx.scene.image.ImageView.setImage()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中javafx.scene.image.ImageView.setImage()方法的一些代码示例,展示了ImageView.setImage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setImage()方法的具体详情如下:
包路径:javafx.scene.image.ImageView
类名称:ImageView
方法名:setImage

ImageView.setImage介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

imageView.setImage(image);

代码示例来源:origin: jfoenixadmin/JFoenix

private void updatePlaceholder(Node newView) {
    if (view.getWidth() > 0 && view.getHeight() > 0) {
      SnapshotParameters parameters = new SnapshotParameters();
      parameters.setFill(Color.TRANSPARENT);
      Image placeholderImage = view.snapshot(parameters,
        new WritableImage((int) view.getWidth(), (int) view.getHeight()));
      placeholder.setImage(placeholderImage);
      placeholder.setFitWidth(placeholderImage.getWidth());
      placeholder.setFitHeight(placeholderImage.getHeight());
    } else {
      placeholder.setImage(null);
    }
    placeholder.setVisible(true);
    placeholder.setOpacity(1.0);
    view.getChildren().setAll(placeholder, newView);
    placeholder.toFront();
  }
}

代码示例来源:origin: stackoverflow.com

public class Controller implements Initializable{

 @FXML
 private ImageView imageView;

 @Override
 public void initialize(URL location, ResourceBundle resources) {

   imageView.setImage("path here");
 }

}

代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx

public void handle(MouseEvent evt) {
  iv.setImage(pushed);
 }
});

代码示例来源:origin: stackoverflow.com

public class MyController {

  @FXML
  private ImageView myImageView ;

  public void initialize() { // or in an event handler, or when you externally set the image, etc
    Path imageFile = Paths.get("/path/to/image/file");
    myImageView.setImage(new Image(imageFile.toUri().toURL().toExternalForm()));

  }
}

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

private void setPriorityImage(Image unchecked, Image checked, EWeapon weapon, ImageView prioView) {
  if (isPriority(weapon)) {
    prioView.setImage(checked);
  } else{
    prioView.setImage(unchecked);
  }
}

代码示例来源:origin: stackoverflow.com

Image graph = new Image(Files.newInputStream(file));
ImageView graphView = new ImageView(graph);

graph = null;
graphView.setImage(null);
System.gc();

代码示例来源:origin: stackoverflow.com

public class SampleController implements Initializable {

  @FXML
  private ImageView imageView;

  @Override
  public void initialize(URL location, ResourceBundle resources) {
    File file = new File("src/Box13.jpg");
    Image image = new Image(file.toURI().toString());
    imageView.setImage(image);
  }
}

代码示例来源:origin: stackoverflow.com

private Image image;

@FXML
ImageView imageview; // type your imageview fixid

  private void setImage(String url) {
  try {
    image = new Image(url);
    imageview.setImage(image);
  } catch (Exception e) {
    System.out.println(e);
  }

}

代码示例来源:origin: stackoverflow.com

@FXML
ImageView image;

@Override
public void initialize(URL url, ResourceBundle rb) {
 image.setImage(new Image ("/about.jpg"));
}

代码示例来源:origin: io.datafx/flow

private void clearPlaceholder() {
  placeholder.setImage(null);
  placeholder.setVisible(false);
}

代码示例来源:origin: stackoverflow.com

@Override
public void handle(MouseEvent event) {
  final ImageView iv = (ImageView) (event.getTarget());
  iv.setImage(new Image("popped.png"));
}

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Updates the visual clue for whether the current tweet was already liked by the current user.
 *
 * @param liked whether the current tweet was determined to having been liked by the current user
 */
private void updateLikeVisual(final boolean liked) {
  likeButtonGraphic.setImage(
      liked ?
      ImageResources.TWEETPANE_LIKE_ON.getImage() :
      ImageResources.TWEETPANE_LIKE_OFF.getImage()
  );
}

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

private void setImage() {
  final InputStream is = getClass().getResourceAsStream("InputPlank.jpg");
  Image img1 = new Image(is,width.doubleValue(), height.doubleValue(), false, true);
  imgView.setImage(img1);
  imgView.setLayoutY(0);
}

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

private void calculateNewDimensions() {
  Dimension2D dim = calculateButtonDimensions(button);
  // add padding
  ImageFactory imageFactory = new ImageFactory();
  Image img = imageFactory.getSlabImage(dim);
  imageView.setImage(img);
}

代码示例来源:origin: com.guigarage/imaging

public void setImage(Image image) {
  unfilteredImage = image;
  if (filter.get() != null && image != null) {
    imageView.setImage(ImageUtilities.filter(image, filter.get()));
  } else {
    imageView.setImage(image);
  }
  imageRegion.setTranslateX(0);
  imageRegion.setTranslateY(0);
  imageRegion.setScaleX(1);
  imageRegion.setScaleY(1);
}

代码示例来源:origin: com.bitplan.radolan/com.bitplan.radolan

/**
 * init the Image
 */
public void initImage() {
 // simple displays ImageView the image as is
 imageView = new ImageView();
 imageView.setImage(getImage());
 imageView.setSmooth(true);
 imageView.setCache(true);
}

代码示例来源:origin: stackoverflow.com

// resizes the image to have width and height of 100 while preserving the ratio and using
 // higher quality filtering method; this ImageView is also cached to 
// improve performance

ImageView iv2 =newImageView();     iv2.setImage(image);
iv2.setFitHeight(100);  iv2.setFitWidth(100);  iv2.setPreserveRatio(true); iv2.setSmooth(true); iv2.setCache(true);

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  authorProfilePicturePane.setClip(Clipping.getCircleClip(24.0));
  Nodes.hideAndResizeParentIf(retweetHbox, isRetweet);
  authorProfilePicture.setImage(GENERAL_USER_AVATAR_DARK.getImage());
  setUpInteractionButtons();
  mediaBox.setManaged(false);
  mediaBox.setVisible(false);
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  userProfilePictureBorder.visibleProperty().bind(sessionManager.isLoggedInProperty());
  userProfilePicture.setClip(Clipping.getCircleClip(32.0));
  userProfilePicture.setImage(CONTROLBAR_ADD_USER.getImage());
  userProfilePicture.setOnMouseClicked(e -> handleClickOnProfile());
  bindUsername();
  bindProfilePicture();
}

相关文章