import javafx.application.Application; import javafx.geometry.*; import javafx.scene.layout.*; import javafx.event.*; import javafx.stage.*; import javafx.scene.*; import javafx.scene.shape.*; import javafx.scene.paint.*; import javafx.scene.input.*; public class Test2 extends Application { public void start(Stage stage) { Pane pane = new Pane(); pane.setPadding(new Insets(100)); pane.setPrefSize(400, 200); pane.setPickOnBounds(false); final CornerRadii radii = new CornerRadii(150, 150, 150, 150, false); pane.setBackground(new Background(new BackgroundFill(Color.BLUE, radii, new Insets(70)))); pane.addEventHandler(MouseEvent.MOUSE_MOVED, new EventHandler() { public void handle(MouseEvent e) { Color c = new Color(Math.random(), Math.random(), Math.random(), 1.0); pane.setBackground(new Background(new BackgroundFill(c, radii, new Insets(70)))); } }); Scene scene = new Scene(pane, 500, 300); stage.setScene(scene); stage.show(); } }