本文整理匯總了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));
}