GenerateExamsCtrl.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:Luna-Exam-Builder 作者:
@Override
public void initialize(URL location, ResourceBundle resources) {

    //Set fields
    titleField.setText(MainApp.currentExam.title);
    authorField.setText(MainApp.currentExam.author);
    //Set format selection box
    formatBox.setItems(FXCollections.observableArrayList(FORMATS));
    formatBox.getSelectionModel().select(3);
    //set max export label
    System.out.println(MainApp.questionObservableList.size());
    int max = factorial(MainApp.questionObservableList.size());
    maxExportLabel.setText("You can generate up to "+ NumberFormat.getIntegerInstance().format(max) + " different exams");

    //make the tree
    TreeItem root = new TreeItem<>("Exam");
    root.setExpanded(true);
    questionTreeView.setRoot(root);
    //add each question
    for (Question question: MainApp.questionObservableList) {
        TreeItem<String> q = new TreeItem<>(question.getTitle());
        for (String option: question.options) {
            TreeItem<String> o = new TreeItem<>(option);
            q.getChildren().add(o);
        }
        q.setExpanded(true);
        root.getChildren().add(q);
    }
    questionTreeView.setShowRoot(false);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号