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.SplitMenuButton; import javafx.scene.layout.BorderPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; /** * Created with IntelliJ IDEA. * User: slugovoy * Date: 26.09.13 * Time: 15:49 * To change this template use File | Settings | File Templates. */ public class Main 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 SplitMenuButton split= new SplitMenuButton(); final Button button = new Button(); decorate(button); decorate(split); pane.setCenter(new VBox(50){{ getChildren().addAll(split, 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); } }