javafx.scene.layout.BackgroundRepeat Java Examples

The following examples show how to use javafx.scene.layout.BackgroundRepeat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColorMapDialog.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** 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))));
}
 
Example #2
Source File: InfiniteCanvas.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Repaints the tile image that depends on the grid cell size only. The tile
 * image is repeated when repainting the grid.
 */
protected void repaintGrid() {
	Image tile = createGridTile();
	// create a background fill for this node from the tile image
	BackgroundPosition backgroundPosition = new BackgroundPosition(
			Side.LEFT, 0, false, Side.TOP, 0, false);
	BackgroundImage backgroundImage = new BackgroundImage(tile,
			BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT,
			backgroundPosition, BackgroundSize.DEFAULT);
	Background background = new Background(backgroundImage);
	// apply that background fill
	grid.setBackground(background);
}
 
Example #3
Source File: HandCard.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
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);
	}
}