import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class BackgroundCheck extends Application { 
	private static final BackgroundFill outer = new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY); 
	private static final BackgroundFill inner = new BackgroundFill(Color.LIGHTBLUE, CornerRadii.EMPTY, Insets.EMPTY); 

	@Override 
	public void start(Stage stage) { 
		StackPane root = new StackPane(); 
		root.setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY), 
				new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, new Insets(1)))); 

		Button button = new Button("click me!"); 
		button.setBackground(new Background(outer, inner)); 
		button.setOnAction(actionEvent -> 
		{ double x = Math.random() * 50; button.setTranslateX(x); double y = Math.random() * 50; button.setTranslateY(y); System.out.println(x + " / " + y); } 

				); 
		root.getChildren().add(button); 

		Scene scene = new Scene(root, 300, 300); 
		stage.setScene(scene); 
		stage.show(); 
	} 
	public static void main(String[] args) {
		launch(args);
	}
	
} 

