本文整理汇总了Java中javafx.scene.image.ImageView.getFitWidth方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.getFitWidth方法的具体用法?Java ImageView.getFitWidth怎么用?Java ImageView.getFitWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.getFitWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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();
final JMEFilePreviewManager previewManager = JMEFilePreviewManager.getInstance();
previewManager.show(file, width, height);
final ImageView sourceView = previewManager.getImageView();
imageView.imageProperty().bind(sourceView.imageProperty());
}
示例3: 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));
}