import com.sun.javafx.runtime.VersionInfo; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Labeled; import javafx.scene.control.RadioButton; import javafx.scene.layout.BorderPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class JavaApplication3 extends Application{ String text = "Radio the first line" + "\nthe sec long line" + "\nthe third line"; String style = "-fx-wrap-text:true;-fx-border-color:red;"; @Override public void start(Stage stage) throws Exception { BorderPane pane = new BorderPane(); final RadioButton radio = new RadioButton(); final Button button = new Button(); decorate(button); decorate(radio); pane.setCenter(new VBox(50){{ getChildren().addAll(radio, button); }}); Scene scene = new Scene(pane, 500, 400); stage.setScene(scene); stage.show(); stage.setTitle(VersionInfo.getRuntimeVersion()); } private void decorate (Labeled control) { control.setGraphic(new Rectangle(10, 10, Color.web("lightblue"))); control.setText(text); control.setStyle(style); control.setPrefWidth(60); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }