本文整理了Java中javafx.scene.image.ImageView.setFitHeight()
方法的一些代码示例,展示了ImageView.setFitHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setFitHeight()
方法的具体详情如下:
包路径:javafx.scene.image.ImageView
类名称:ImageView
方法名:setFitHeight
暂无
代码示例来源:origin: speedment/speedment
@Override
public ImageView createNode() {
final ImageView view = new ImageView();
view.setPreserveRatio(true);
view.setFitHeight(48);
brand.logoLarge()
.map(Image::new)
.ifPresent(view::setImage);
return view;
}
代码示例来源: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
Image fullImage = new Image(imageURL);
// define crop in image coordinates:
Rectangle2D croppedPortion = new Rectangle2D(x, y, width, height);
// target width and height:
double scaledWidth = ... ;
double scaledHeight = ... ;
ImageView imageView = new ImageView(fullImage);
imageView.setViewport(croppedPortion);
imageView.setFitWidth(scaledWidth);
imageView.setFitHeight(scaledHeight);
imageView.setSmooth(true);
代码示例来源:origin: stackoverflow.com
public Image scale(Image source, int targetWidth, int targetHeight, boolean preserveRatio) {
ImageView imageView = new ImageView(source);
imageView.setPreserveRatio(preserveRatio);
imageView.setFitWidth(targetWidth);
imageView.setFitHeight(targetHeight);
return imageView.snapshot(null, null);
}
代码示例来源:origin: com.bitplan.radolan/com.bitplan.radolan
/**
* add a size Listener
*/
public void addSizeListener(ObservableValue<Number> widthProperty,
ObservableValue<Number> heightProperty) {
ChangeListener<Number> widthListener = (observable, oldValue, newValue) -> {
imageView.setFitWidth((double) newValue);
if (debug)
LOGGER.log(Level.INFO,
String.format("width %.0f->%.0f", oldValue, newValue));
};
ChangeListener<Number> heightListener = (observable, oldValue,
newValue) -> {
imageView.setFitHeight((double) newValue);
if (debug)
LOGGER.log(Level.INFO,
String.format("height %.0f->%.0f", oldValue, newValue));
};
widthProperty.addListener(widthListener);
heightProperty.addListener(heightListener);
}
代码示例来源:origin: stackoverflow.com
iconImageView.setFitHeight(30);
iconImageView.setPreserveRatio(true);
setGraphic(iconImageView);
代码示例来源:origin: stackoverflow.com
setCollapsible(true);
ImageView img = new ImageView(new Image(getClass().getResource("unlock24.png").toExternalForm()));
img.setFitHeight(10d);
img.setPreserveRatio(true);
img.setSmooth(true);
代码示例来源:origin: Tristan971/Lyrebird
try {
final ImageView imageView = new ImageView();
imageView.setFitHeight(MEDIA_PREVIEW_IMAGE_SIZE);
imageView.setFitWidth(MEDIA_PREVIEW_IMAGE_SIZE);
final URL imageUrl = previewedFile.toURI().toURL();
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
if (iconUrl != null) {
ImageView iconImage = new ImageView(iconUrl.toString());
iconImage.setFitHeight(fontSize);
iconImage.setFitWidth(fontSize);
iconImage.setId(name);
代码示例来源: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: stackoverflow.com
ImageView iview1 = new ImageView(img);
iview1.setFitWidth(300);
iview1.setFitHeight(300);
iview1.setPreserveRatio(true);
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
@PostConstruct
private void initializeControl() {
clientServerEventBus.register(this);
clientEventBus.register(this);
setManaged(false);
mapPane = new Pane();
imgView = new ImageView();
imgView.setFitWidth(236);
imgView.setFitHeight(192);
imgView.setPreserveRatio(false);
// scale the map to the correct size add white dots on cities that have ship in them
// clicking on the city changes into the other city (if there is a ship or kontor
// right clicking on a point on the map sends the active ship to that location
mapPane.getChildren().addAll(imgView);
getChildren().add(mapPane);
addEventHandlers();
}
public void setDialogContoller(IDialogContoller dialogContoller) {
代码示例来源:origin: com.aquafx-project/aquafx
typeImage = new ImageView(img);
typeImage.setPreserveRatio(true);
typeImage.setFitHeight(32);
} else {
dotImage = new ImageView(NsImageIconLoader.load(NsImageIcon.STATUS_PARTIALLY_AVAILABLE));
typeImage = new ImageView(img);
typeImage.setPreserveRatio(true);
typeImage.setFitHeight(32);
代码示例来源:origin: Tristan971/Lyrebird
imageView.setImage(imageResource.getImage());
imageView.setFitWidth(EMBEDDED_MEDIA_RECTANGLE_SIDE);
imageView.setFitHeight(EMBEDDED_MEDIA_RECTANGLE_SIDE);
代码示例来源:origin: stackoverflow.com
ImageView imgHolder = new ImageView(loadImg);
imgHolder.setVisible(false);
imgHolder.setFitHeight(100);
imgHolder.setFitWidth(100);
代码示例来源:origin: stackoverflow.com
public GridPane moonpane() {
GridPane Moonpane = new GridPane();
Moonpane.setId("moonpane");
Moonpane.getColumnConstraints().setAll(
ColumnConstraintsBuilder.create().prefWidth(160).minWidth(160).build(),
ColumnConstraintsBuilder.create().prefWidth(100).minWidth(100).build()
);
Moonpane.setHgap(10);
Moonpane.setMaxHeight(50);
ImageView Moon_img = new ImageView(new Image(getClass().getResourceAsStream("/Images/Moon/100%.png")));
Moon_img.setFitWidth(100);
Moon_img.setFitHeight(100);
Moon_img.setPreserveRatio(true);
Moon_img.setSmooth(true);
Moon_Image_Label.setGraphic(Moon_img);
Moonpane.setConstraints(Moon_Image_Label, 1, 0);
Moonpane.getChildren().add(Moon_Image_Label);
Moon_Date_Label.setId("moon-text-english");
Moonpane.setConstraints(Moon_Date_Label, 0, 0);
Moonpane.getChildren().add(Moon_Date_Label);
Reflection r = new Reflection();
r.setFraction(0.15f);
Moonpane.setEffect(r);
Moonpane.setGridLinesVisible(true);
return Moonpane;
}
代码示例来源:origin: com.github.giulianini.jestures/jestures
/**
* Create a {@link JFXListView} for the templates.
*
* @param listView
* the {@link JFXListView}
* @param imageProfile
* the {@link Image} profile
* @param index
* the {@link Integer} index
*/
// CHECKSTYLE:OFF AH DI MI TOCCA FARE COSI
public static void addVectorToListView(final JFXListView<BorderPane> listView, final Image imageProfile,
final int index) {
final BorderPane pane = new BorderPane();
final Label label = new Label(" " + index);
final ImageView imageView = new ImageView(imageProfile);
JFXDepthManager.setDepth(pane, 1);
label.setId("player-listView-label");
pane.setId("player-listView-border");
imageView.setFitHeight(150);
imageView.setFitWidth(200);
BorderPane.setAlignment(imageView, Pos.CENTER);
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
pane.setCenter(imageView);
pane.setLeft(label);
listView.getItems().add(pane);
listView.scrollTo(index);
}
// CHECKSTYLE:ON
代码示例来源:origin: io.datafx/flow
private void updatePlaceholder(Node newView) {
if (root.getWidth() > 0 && root.getHeight() > 0) {
Image placeholderImage = root.snapshot(null, new WritableImage((int) root.getWidth(), (int) root.getHeight()));
placeholder.setImage(placeholderImage);
placeholder.setFitWidth(placeholderImage.getWidth());
placeholder.setFitHeight(placeholderImage.getHeight());
} else {
placeholder.setImage(null);
}
placeholder.setVisible(true);
placeholder.setOpacity(1.0);
root.getChildren().setAll(placeholder);
root.getChildren().add(newView);
placeholder.toFront();
}
}
代码示例来源:origin: com.aquafx-project/aquafx
ImageView pages = new ImageView(image);
pages.setPreserveRatio(true);
pages.setFitHeight(36);
tab1.setGraphic(pages);
Label label =new Label("Allgemein...");
ImageView layout = new ImageView(image2);
layout.setPreserveRatio(true);
layout.setFitHeight(36);
tab2.setGraphic(layout);
Label label2 = new Label("Etiketten");
ImageView umbruch = new ImageView(image3);
umbruch.setPreserveRatio(true);
umbruch.setFitHeight(36);
tab3.setGraphic(umbruch);
Label label3 = new Label("seitenleiste...");
ImageView text = new ImageView(image4);
text.setPreserveRatio(true);
text.setFitHeight(36);
tab4.setGraphic(text);
代码示例来源:origin: GoMint/GoMint
public UiNoReportOpen() {
this.setBackground( new Background( new BackgroundFill( ColorPalette.UI_BACKGROUND.getPaint(),
null, null ) ) );
this.goMintLogoView.setFitWidth( 150 );
this.goMintLogoView.setFitHeight( 150 );
this.performanceViewerTitle.setFont( Font.font( 20 ) );
this.performanceViewerTitle.setTextFill( ColorPalette.UI_FOREGROUND.getPaint() );
this.performanceViewerSubTitle.setTextFill( ColorPalette.UI_SECONDARY_FOREGROUND.getPaint() );
VBox mainContainer = new VBox();
HBox secondaryContainer = new HBox();
VBox textContainer = new VBox();
Pane separator = new Pane();
separator.setPrefHeight( 2 );
separator.setMaxWidth( 500 );
separator.setBackground( new Background( new BackgroundFill( ColorPalette.UI_BACKGROUND_SECONDARY.getPaint(),
null, null ) ) );
mainContainer.setSpacing( 20 );
mainContainer.setAlignment( Pos.CENTER );
mainContainer.getChildren().addAll( new UiStatusUpdate( "Current build status | Bloody Edge" ),
secondaryContainer, separator, new UiButton( "Open performance report" ) );
secondaryContainer.setSpacing( 20 );
secondaryContainer.setAlignment( Pos.CENTER );
secondaryContainer.getChildren().addAll( this.goMintLogoView, textContainer );
textContainer.setSpacing( 5 );
textContainer.setAlignment( Pos.CENTER_LEFT );
textContainer.getChildren().addAll( this.performanceViewerTitle, this.performanceViewerSubTitle );
this.setAlignment( Pos.CENTER );
this.getChildren().addAll( mainContainer );
}
内容来源于网络,如有侵权,请联系作者删除!