如何显示标签文字?

时间:2014-04-18 19:26:17

标签: javafx label

如图所示,ComboBox旁边的第三个框中的标签上有文字' ...'而不是' fase'。

我之前曾试图增加它所在的HBox的大小,增加间距,但无济于事。有什么建议吗?

descriptive picture

public void start(Stage primaryStage) {
    RadioButtonCustom inhoud = new RadioButtonCustom();
    Fieldset fs = new Fieldset("eerste", inhoud);
    RadioButtonCustom inhoud2 = new RadioButtonCustom();
    Fieldset fs2 = new Fieldset("tweede", inhoud2);
    //error
    HBox hb = new HBox();
    hb.minWidth(200);
    Label fase = new Label("fase");
    fase.setText("Fase");
    fase.minWidth(500);
    fase.getStyleClass().add("bordered-titled-title");
    StackPane.setAlignment(fase, Pos.CENTER);

    ComboBox<Integer> cb = new ComboBox<>();
    hb.setSpacing(40);
    for (Integer i : array) {
        cb.getItems().add(i);
    }
    hb.getChildren().addAll(fase,cb);
    Fieldset fs3 = new Fieldset("fase",hb);
    // einde error
    VBox vb = new VBox();
    vb.getChildren().addAll(fs, fs2,fs3);
    vb.setSpacing(20);



    Button btn = new Button();
    btn.setText("Say 'Hello World'");
    btn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Hello World!");
        }
    });

    BorderPane root = new BorderPane();
    root.getChildren().add(vb);

    Scene scene = new Scene(root, 500, 500);
    scene.getStylesheets().add("/lissa/stijl.css");

    primaryStage.setTitle("Hello World!");
    primaryStage.setScene(scene);
    primaryStage.show();
}

0 个答案:

没有答案