本文整理汇总了Java中javafx.scene.layout.BackgroundPosition类的典型用法代码示例。如果您正苦于以下问题:Java BackgroundPosition类的具体用法?Java BackgroundPosition怎么用?Java BackgroundPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BackgroundPosition类属于javafx.scene.layout包,在下文中一共展示了BackgroundPosition类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getBackground
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
@Override
public ObservableObjectValue<Background> getBackground() {
if (background == null) {
synchronized (lock) {
if (background == null) {
ObservableObjectValue<Image> bgimg = getBackgroundImage();
background = Bindings.createObjectBinding(() -> new Background(new BackgroundImage(
bgimg.get(),
BackgroundRepeat.NO_REPEAT,
BackgroundRepeat.NO_REPEAT,
BackgroundPosition.CENTER,
new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, true, true, true, true))), bgimg);
}
}
}
return background;
}
开发者ID:to2mbn,项目名称:LoliXL,代码行数:18,代码来源:ImageBackgroundProvider.java
示例2: loadOverlay
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
public Background loadOverlay(String imageName, String widthAsString, String heightAsString) {
DebugConsole.getDefault().debug(this.getClass(), "Load Overlay image: " + imageName + " (" + widthAsString + ", " + heightAsString + ")"); // NOI18N
final double width = this.convertStringToDouble(widthAsString);
final double height = this.convertStringToDouble(heightAsString);
final Image overlay = overlayImages.computeIfAbsent(
imageName,
image -> {
return this.load(OverlayLoader.class, image, width, height);
});
final BackgroundSize backgroundSize = new BackgroundSize(width, height, false, false, false, false);
final BackgroundImage backgroundImage = new BackgroundImage(overlay, BackgroundRepeat.REPEAT,
BackgroundRepeat.REPEAT, BackgroundPosition.CENTER, backgroundSize);
final Background background = new Background(backgroundImage);
return background;
}
开发者ID:Naoghuman,项目名称:Incubator,代码行数:20,代码来源:ImageLoader.java
示例3: updateColorBar
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
/** Update color bar in UI from current 'map' */
private void updateColorBar()
{
// On Mac OS X it was OK to create an image sized 256 x 1:
// 256 wide to easily set the 256 colors,
// 1 pixel height which is then stretched via the BackgroundSize().
// On Linux, the result was garbled unless the image height matched the
// actual height, so it's now fixed to COLOR_BAR_HEIGHT
final WritableImage colors = new WritableImage(256, COLOR_BAR_HEIGHT);
final PixelWriter writer = colors.getPixelWriter();
for (int x=0; x<256; ++x)
{
final int arfb = ColorMappingFunction.getRGB(map.getColor(x));
for (int y=0; y<COLOR_BAR_HEIGHT; ++y)
writer.setArgb(x, y, arfb);
}
// Stretch image to fill color_bar
color_bar.setBackground(new Background(
new BackgroundImage(colors, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT,
BackgroundPosition.DEFAULT,
new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, true, true, true, true))));
}
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:23,代码来源:ColorMapDialog.java
示例4: drawBackground
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
protected void drawBackground (String url) {
if (url == null) {
return;
}
Image img = getImage(url);
BackgroundImage background = new BackgroundImage(img,
BackgroundRepeat.NO_REPEAT,
BackgroundRepeat.NO_REPEAT,
BackgroundPosition.DEFAULT,
BackgroundSize.DEFAULT);
myPane.setBackground(new Background(background));
myPane.setMinWidth(img.getWidth());
myPane.setMinHeight(img.getHeight());
}
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:15,代码来源:LevelRenderer.java
示例5: checkBackgroundPosition
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
public boolean checkBackgroundPosition(BackgroundPosition[] first, BackgroundPosition[] second) {
if (first == second) {
return true;
}
if (first.length != second.length) {
return false;
}
for (int i = 0; i < first.length; i++) {
BackgroundPosition firstPosition = first[i];
BackgroundPosition secondPosition = second[i];
if (firstPosition == secondPosition) {
continue;
}
if (firstPosition.isHorizontalAsPercentage() != secondPosition.isHorizontalAsPercentage()) {
return false;
}
if (firstPosition.isVerticalAsPercentage() != secondPosition.isVerticalAsPercentage()) {
return false;
}
if (Double.valueOf(firstPosition.getHorizontalPosition()).longValue() != Double.valueOf(secondPosition.getHorizontalPosition()).longValue()) {
return false;
}
if (Double.valueOf(firstPosition.getVerticalPosition()).longValue() != Double.valueOf(secondPosition.getVerticalPosition()).longValue()) {
return false;
}
if (firstPosition.getHorizontalSide() != secondPosition.getHorizontalSide()) {
return false;
}
if (firstPosition.getVerticalPosition() != secondPosition.getVerticalPosition()) {
return false;
}
}
return true;
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:35,代码来源:BaseStyleNodeTest.java
示例6: CustomExtractIcon
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
public CustomExtractIcon(final InternalWindow w) {
getStyleClass().setAll("custom-close-icon");
BackgroundImage img = new BackgroundImage(
new Image(FileUtils.getResourceToExternalForm("/img/extract.png"), 15, 15, false, true),
BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER,
BackgroundSize.DEFAULT);
setBackground(new Background(img));
setOnAction((e) -> w.toggleWindowExtracted());
}
开发者ID:mbway,项目名称:Simulizer,代码行数:10,代码来源:CustomExtractIcon.java
示例7: handleDeviceNameOkPressed
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
@FXML
protected void handleDeviceNameOkPressed() {
progressOverlay.setVisible(true);
String deviceName = deviceNameField.getText();
Main.getInstance().getSignalAccount().getQrCode(qr -> {
Image img = new Image(new File(qr).toURI().toString(), 300, 300, true, false);
BackgroundImage backgroundImg = new BackgroundImage(img, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT,
BackgroundPosition.CENTER, BackgroundSize.DEFAULT);
Platform.runLater(new Runnable() {
@Override
public void run() {
qrCodeViewer.setBackground(new Background(backgroundImg));
step2.setVisible(false);
step3.setVisible(true);
progressOverlay.setVisible(false);
Main.getInstance().getSignalAccount().finishRegistration(deviceName, (Void) -> {
Platform.runLater(new Runnable() {
@Override
public void run() {
step3.setVisible(false);
step4.setVisible(true);
Main.getInstance().getSignalAccount().startPreKeysRefreshTimer((Void) -> {
System.out.println("Prekeys registered!");
});
}
});
});
}
});
});
}
开发者ID:Turakar,项目名称:Signal-JDesktop,代码行数:32,代码来源:RegistrationController.java
示例8: hideCard
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
private void hideCard(boolean hide) {
topPane.setVisible(!hide);
centerPane.setVisible(!hide);
bottomPane.setVisible(!hide);
if (hide) {
BackgroundSize size = new BackgroundSize(getWidth(), getHeight(), false, false, true, false);
BackgroundImage image = new BackgroundImage(IconFactory.getDefaultCardBack(), BackgroundRepeat.NO_REPEAT,
BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, size);
Background background = new Background(image);
setBackground(background);
}
}
开发者ID:demilich1,项目名称:metastone,代码行数:13,代码来源:HandCard.java
示例9: loadAsBackground
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
/**
* Loads the given {@link com.github.naoghuman.lib.tile.core.Tile} with the
* {@link com.github.naoghuman.lib.tile.core.TileLoader} as an
* {@link javafx.scene.image.Image} which will be converted to a
* {@link javafx.scene.layout.Background}.
*
* @param tileLoader loads the given {@link com.github.naoghuman.lib.tile.core.Tile}
* as an {@link javafx.scene.image.Image} which will then be converted to a
* {@link javafx.scene.layout.Background}.
* @param tile the {@link com.github.naoghuman.lib.tile.core.Tile} which should be
* loaded as a {@link javafx.scene.layout.Background}.
* @return the loaded {@link javafx.scene.layout.Background}.
* @see com.github.naoghuman.lib.tile.core.TileLoader
* @see com.github.naoghuman.lib.tile.core.Tile
* @see javafx.scene.layout.Background
* @see javafx.scene.image.Image
*/
public Optional<Background> loadAsBackground(final TileLoader tileLoader, final Tile tile) {
Optional<Background> background = Optional.empty();
final Optional<Image> image = TileProvider.getDefault().loadAsImage(tileLoader, tile);
if (image.isPresent()) {
final BackgroundSize backgroundSize = new BackgroundSize(
tile.getWidth(), tile.getHeight(),
false, false, false, false);
final BackgroundImage backgroundImage = new BackgroundImage(
image.get(), BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT,
BackgroundPosition.CENTER, backgroundSize);
background = Optional.ofNullable(new Background(backgroundImage));
}
return background;
}
开发者ID:Naoghuman,项目名称:lib-tile,代码行数:33,代码来源:TileProvider.java
示例10: setTableauBackground
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
/**
* Sets the background image for the tableau.
*
* @param tableauBackground The {@link Image} object to set.
*/
public void setTableauBackground(Image tableauBackground) {
setBackground(new Background(new BackgroundImage(tableauBackground,
BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT,
BackgroundPosition.CENTER, BackgroundSize.DEFAULT)));
}
开发者ID:ZoltanDalmadi,项目名称:JCardGamesFX,代码行数:11,代码来源:KlondikeGameArea.java
示例11: setBackground
import javafx.scene.layout.BackgroundPosition; //导入依赖的package包/类
/**
* Effect: sets the background image of a region to be white with a
* specified image on top of it.
*
* @param n
* the node
* @param i
* the image
*/
private static void setBackground(Region n, Image i) {
BackgroundImage back = new BackgroundImage(i, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, new BackgroundSize(100, 100, true, true, true, false));
Platform.runLater(() -> n.setBackground(new Background(new BackgroundFill[] { new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY) }, new BackgroundImage[] { back })));
}
开发者ID:orangeturtle739,项目名称:Grow,代码行数:14,代码来源:Grow.java
注:本文中的javafx.scene.layout.BackgroundPosition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论