import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.Stage; public class RT25274 extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { VBox vb = new VBox(); Button b = new Button("Text text text text text text"); b.setWrapText(true); Slider s = new Slider(0, 100, 100); s.valueProperty().bindBidirectional(b.prefWidthProperty()); Pane pane = new Pane(); pane.setPrefSize(200, 200); pane.getChildren().add(b); vb.getChildren().addAll(pane, s); stage.setScene(new Scene(vb, 300, 300)); stage.show(); } }