import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.DepthTest; import javafx.scene.Group; import javafx.scene.PerspectiveCamera; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.Region; import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.scene.transform.Rotate; import javafx.stage.Stage; /** * * @author Alexander Kouznetsov */ public class RegionStyleTest extends Application{ @Override public void start(Stage primaryStage) { Region region = new Region() { { Button button = new Button("button"); getChildren().setAll(button); } }; region.setMinSize(100, 100); region.setPrefSize(100, 100); region.widthProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue ov, Number t, Number t1) { System.out.println("width = " + t1); } }); region.setStyle("-fx-border-color: red; -fx-background-color: yellow;"); Scene scene = new Scene(region); primaryStage.setScene(scene); primaryStage.setVisible(true); } public static void main(String[] args) { launch(args); } }