weixin_39918128 2020-11-20 18:07
浏览 0

RuntimeException from Wizard with controls without value

Original report by Andreas Liebelt (Bitbucket: aliebelt, GitHub: aliebelt).

I tried to use the new Wizard API. But I get a RuntimeException if controls has no value.

Click on next and the exception is thrown:


#!java

import javafx.application.Application;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

import org.controlsfx.dialog.Wizard;
import org.controlsfx.dialog.Wizard.LinearFlow;
import org.controlsfx.dialog.Wizard.WizardPane;

public class RunWizard extends Application {


    public void start(Stage primaryStage) throws Exception {
        GridPane gridPane = new GridPane();
        Label label1 = new Label("Name");
        Label label2 = new Label("Driver");
        TextField textField = new TextField();
        textField.setId("name");
        ComboBox<string> comboBox = new ComboBox<>();
        comboBox.setId("driver");
        gridPane.add(label1, 0, 0);
        gridPane.add(label2, 0, 1);
        gridPane.add(textField, 1, 0);
        gridPane.add(comboBox, 1, 1);

        WizardPane page1 = new WizardPane();
        page1.setContent(gridPane);
        WizardPane page2 = new WizardPane();
        WizardPane page3 = new WizardPane();

        Wizard wizard = new Wizard();
        wizard.setFlow(new LinearFlow(page1, page2, page3));

        // show wizard and wait for response
        wizard.showAndWait().ifPresent(result -> {
            if (result == ButtonType.FINISH) {
                System.out.println("Wizard finished, settings: " + wizard.getSettings());
            }
        });
    }

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

}
</string>

Exception:


#!java

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Unable to get children for Parent of type class javafx.scene.layout.Region. useReflection is set to false
    at impl.org.controlsfx.ImplUtils.getChildren(ImplUtils.java:121)
    at impl.org.controlsfx.ImplUtils.getChildren(ImplUtils.java:97)
    at org.controlsfx.dialog.Wizard.checkNode(Wizard.java:499)
    at org.controlsfx.dialog.Wizard.checkNode(Wizard.java:505)
    at org.controlsfx.dialog.Wizard.checkNode(Wizard.java:505)
    at org.controlsfx.dialog.Wizard.checkNode(Wizard.java:505)
    at org.controlsfx.dialog.Wizard.readSettings(Wizard.java:487)
    at org.controlsfx.dialog.Wizard.lambda$updatePage$91(Wizard.java:407)
    at org.controlsfx.dialog.Wizard$$Lambda$144/2042564910.accept(Unknown Source)
    at java.util.Optional.ifPresent(Optional.java:159)
    at org.controlsfx.dialog.Wizard.updatePage(Wizard.java:402)
    at org.controlsfx.dialog.Wizard.lambda$new$89(Wizard.java:162)
    at org.controlsfx.dialog.Wizard$$Lambda$84/1831518176.handle(Unknown Source)

etc.

该提问来源于开源项目:controlsfx/controlsfx

  • 写回答

11条回答 默认 最新

  • weixin_39918128 2020-11-20 18:07
    关注

    Original comment by Samir Hadzic (Bitbucket: shadzic, GitHub: shadzic).

    Issue #519 was marked as a duplicate of this issue.

    评论

报告相同问题?