我的CheckBox中的下划线在哪里?

use*_*222 7 checkbox javafx javafx-8

用于显示问题的最短程序:

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;


public class TestCheckBox extends Application  {

    public static void main(String[] args) {
        launch(args);
    }

    public void start(Stage stage) {
        Scene scene = new Scene(new StackPane());
        final VBox vbox = new VBox();
        vbox.getChildren().addAll(new Label("ABC_DEF"), new CheckBox("ABC_DEF"));
        ((StackPane) scene.getRoot()).getChildren().add(vbox);
        stage.setScene(scene);
        stage.show();
    }
}
Run Code Online (Sandbox Code Playgroud)

导致:

在此输入图像描述

相比之下,在SceneBuilder中它正常显示,但不在我的应用程序中.我正在运行Java 1.8.0-b129

任何提示?

jew*_*sea 15

你可能想setMnemonicParsingfalse上的复选框.

MnemonicParsing属性,用于启用/禁用文本解析.如果将其设置为true,则将解析Label文本以查看它是否包含助记符解析字符"_".当检测到助记符时,将根据后续字符确定密钥组合,并添加助记符.

Labeled的默认值为false,但默认情况下在某些控件上启用.