当前位置: 首页>>代码示例>>Java>>正文


Java BackgroundImage类代码示例

本文整理汇总了Java中javafx.scene.layout.BackgroundImage的典型用法代码示例。如果您正苦于以下问题:Java BackgroundImage类的具体用法?Java BackgroundImage怎么用?Java BackgroundImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BackgroundImage类属于javafx.scene.layout包,在下文中一共展示了BackgroundImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBackground

import javafx.scene.layout.BackgroundImage; //导入依赖的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.BackgroundImage; //导入依赖的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.BackgroundImage; //导入依赖的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.BackgroundImage; //导入依赖的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: makeTiledBackgroundImage

import javafx.scene.layout.BackgroundImage; //导入依赖的package包/类
private static BackgroundImage makeTiledBackgroundImage(Image image) {
  if (image == null) {
    return null;
  } else {
    return new BackgroundImage(image, null, null, null, null);
  }
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:8,代码来源:WidgetPane.java

示例6: Spike

import javafx.scene.layout.BackgroundImage; //导入依赖的package包/类
public Spike(float x, float y, float w, float h) {
    super(x, y, w, h, BodyType.STATIC, true);

    Region r = new Region();
    r.setPrefSize(w, h);
    r.setBackground(new Background(new BackgroundImage(Config.Images.SPIKE, null, null, null, null)));

    getChildren().add(r);
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:10,代码来源:Spike.java

示例7: Platform

import javafx.scene.layout.BackgroundImage; //导入依赖的package包/类
public Platform(float x, float y, float w, float h) {
    super(x, y, w, h, BodyType.STATIC, true);

    Region r = new Region();
    r.setPrefSize(w, h);
    r.setBackground(new Background(new BackgroundImage(Config.Images.PLATFORM, null, null, null, null)));

    getChildren().add(r);
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:10,代码来源:Platform.java

示例8: CustomExtractIcon

import javafx.scene.layout.BackgroundImage; //导入依赖的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

示例9: makeDeleteMcdirButton

import javafx.scene.layout.BackgroundImage; //导入依赖的package包/类
private Button makeDeleteMcdirButton(GameVersionProvider provider, Parent parent) {
	Button button = new Button();
	ObservableObjectValue<Image> deleteIcon = ImageLoading.load("img/org.to2mbn.lolixl.ui.sidebar.version/delete_mcdir.png");
	button.backgroundProperty().bind(Bindings.createObjectBinding(() -> new Background(new BackgroundImage(deleteIcon.get(), null, null, null, null)), deleteIcon));
	button.setOnAction(event -> provider.delete());
	return button;
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:8,代码来源:GameVersionsPresenter.java

示例10: handleDeviceNameOkPressed

import javafx.scene.layout.BackgroundImage; //导入依赖的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

示例11: hideCard

import javafx.scene.layout.BackgroundImage; //导入依赖的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

示例12: initialize

import javafx.scene.layout.BackgroundImage; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
	// Let's add nice noise as background to target image.
	Image im = new Image(getClass().getResourceAsStream("/images/targetImageNoise.gif"));
	BackgroundImage bgim = new BackgroundImage(im, null, null, null, null);
	targetImageViewPane.setBackground(new Background(bgim));
	targetImageViewPane.setCache(true);
	targetImageView.setSmooth(true);
	targetImageView.setCache(true);
	allowedExtensions = RegionChecker.allowedExtensions.toArray(new String[0]);
	
	// Set tooltip with full size Target image on targetImageViewPane mouse hover.
	GUIUtil.setImageViewTooltip(targetImageViewPane, fullTargetImageView);
	
	// Setup selectTargetButton.
	selectTargetButton.setGraphic(crosshairIcon);
	selectTargetButtonOrigText = selectTargetButton.getText();
	selectTargetButton.sceneProperty().addListener((o, oldVal, newVal) -> {
		ObjectProperty<KeyCodeCombination> opkcc = HotkeyManager
				.getKeyCodeCombinationPropertyOfHotkey(Hotkey.SELECTIMAGE);
		if (newVal != null) {
			// If inside the Scene, add runnable of this button to Hotkey.
			HotkeyManager.setSelectImageRunnable(selectImageRunnable);
			// Change text of the button to show Hotkey.
			changeSelectTargetButtonBasedOnKeyCombination(opkcc.get());
			opkcc.addListener(selectImageHotkeyListener);
		} else {
			opkcc.removeListener(selectImageHotkeyListener);
			changeSelectTargetButtonBasedOnKeyCombination(null);
			// If outside the Scene, remove runnable of this button from Hotkey.
			HotkeyManager.setSelectImageRunnable(null);
		}
	});
	
	// Set a tooltip showing target file path.
	GUIUtil.createAndBindTooltipToTextfield(targetTextField);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:38,代码来源:TargetImageWithActionsController.java

示例13: initialize

import javafx.scene.layout.BackgroundImage; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
	// Let's add nice noise as background to target image.
	Image im = new Image(getClass().getResourceAsStream("/images/targetImageNoise.gif"));
	BackgroundImage bgim = new BackgroundImage(im, null, null, null, null);
	targetImageViewPane.setBackground(new Background(bgim));
	targetImageViewPane.setCache(true);
	targetImageView.setSmooth(true);
	targetImageView.setCache(true);
	allowedExtensions = RegionChecker.allowedExtensions.toArray(new String[0]);
	coordsVBox.getChildren().add(coordsController.getView());
	similarityVBox.getChildren().add(simController.getView());
	
	// Set tooltip with full size Target image on targetImageViewPane mouse hover.
	GUIUtil.setImageViewTooltip(targetImageViewPane, fullTargetImageView);
	
	// Setup selectTargetButton.
	selectTargetButton.setGraphic(crosshairIcon);
	selectTargetButtonOrigText = selectTargetButton.getText();
	selectTargetButton.sceneProperty().addListener((o, oldVal, newVal) -> {
		ObjectProperty<KeyCodeCombination> opkcc = HotkeyManager
				.getKeyCodeCombinationPropertyOfHotkey(Hotkey.SELECTIMAGE);
		if (newVal != null) {
			// If inside the Scene, add runnable of this button to Hotkey.
			HotkeyManager.setSelectImageRunnable(selectImageRunnable);
			// Change text of the button to show Hotkey.
			changeSelectTargetButtonBasedOnKeyCombination(opkcc.get());
			opkcc.addListener(selectImageHotkeyListener);
		} else {
			opkcc.removeListener(selectImageHotkeyListener);
			changeSelectTargetButtonBasedOnKeyCombination(null);
			// If outside the Scene, remove runnable of this button from Hotkey.
			HotkeyManager.setSelectImageRunnable(null);
		}
	});

	// Set tooltip showing file path.
	GUIUtil.createAndBindTooltipToTextfield(targetTextField);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:40,代码来源:RegionTargetCounterController.java

示例14: initialize

import javafx.scene.layout.BackgroundImage; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
	// Let's add nice noise as background to target image.
	Image im = new Image(getClass().getResourceAsStream("/images/targetImageNoise.gif"));
	BackgroundImage bgim = new BackgroundImage(im, null, null, null, null);
	targetImageViewPane.setBackground(new Background(bgim));
	targetImageViewPane.setCache(true);
	targetImageView.setSmooth(true);
	targetImageView.setCache(true);
	allowedExtensions = RegionChecker.allowedExtensions.toArray(new String[0]);
	coordsVBox.getChildren().add(coordsController.getView());
	similarityVBox.getChildren().add(simController.getView());
	
	// Set tooltip with full size Target image on targetImageViewPane mouse hover.
	GUIUtil.setImageViewTooltip(targetImageViewPane, fullTargetImageView);
	
	// Setup selectTargetButton.
	selectTargetButton.setGraphic(crosshairIcon);
	selectTargetButtonOrigText = selectTargetButton.getText();
	selectTargetButton.sceneProperty().addListener((o, oldVal, newVal) -> {
		ObjectProperty<KeyCodeCombination> opkcc = HotkeyManager
				.getKeyCodeCombinationPropertyOfHotkey(Hotkey.SELECTIMAGE);
		if (newVal != null) {
			// If inside the Scene, add runnable of this button to Hotkey.
			HotkeyManager.setSelectImageRunnable(selectImageRunnable);
			// Change text of the button to show Hotkey.
			changeSelectTargetButtonBasedOnKeyCombination(opkcc.get());
			opkcc.addListener(selectImageHotkeyListener);
		} else {
			opkcc.removeListener(selectImageHotkeyListener);
			changeSelectTargetButtonBasedOnKeyCombination(null);
			// If outside the Scene, remove runnable of this button from Hotkey.
			HotkeyManager.setSelectImageRunnable(null);
		}
	});
	
	// Set a tooltip showing target file path.
	GUIUtil.createAndBindTooltipToTextfield(targetTextField);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:40,代码来源:RegionCheckerController.java

示例15: loadAsBackground

import javafx.scene.layout.BackgroundImage; //导入依赖的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


注:本文中的javafx.scene.layout.BackgroundImage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。