Javafx为问卷创建答案界面

时间:2016-07-20 13:33:43

标签: java javafx

我有一个javafx项目,我想创建一个questionnareis窗格。事实上,我想创建一个带有问题和答案的场景。答案应该是1-10之差,如here。到目前为止,我已经创建了一个以问题和按钮作为答案的GridPane,但是有更好的方法吗?

 BorderPane questionaires = new BorderPane();
 GridPane questionnairesPane, questions;
 questionaires.setTop(questionnairesPane);
 questionaires.setCenter(questionsPane);
 //QUESTIONS Panel
 questionnairesPane = new GridPane();
 questionnairesPane.setHgap(0); 
 questionnairesPane.setVgap(0); 
 questionnairesPane.setPadding(new Insets(0, 0, 0, 200));

 results = new MyTitles("Questionnaires");
 questionnairesPane.setStyle("-fx-font: 150 hamster;  -fx-text-fill: white;");
 questionnairesPane.add(results,1,1);

 questionsPane = new GridPane();
 questionsPane.setHgap(15); 
 questionsPane.setVgap(30); 
 questionsPane.setPadding(new Insets(0, 50, 0, 80)); 
 SsubjectLabel = new Label("What was your affective response during the game?");
 SsubjectLabel.setPrefWidth(1000.0);
 SsubjectLabel.setPrefHeight(70.0);
 SsubjectLabel.setStyle("-fx-font: 30 cornerstone; -fx-text-fill: black;");

 boredom = new Button("Boredom");
 boredom.setStyle("-fx-font: 30 cornerstone; -fx-text-fill: black;");
 boredom.addEventHandler(ActionEvent.ACTION, (e)-> {
 });
 engagement = new Button("Boredom");
 engagement.setStyle("-fx-font: 30 cornerstone; -fx-text-fill: black;");
 engagement.addEventHandler(ActionEvent.ACTION, (e)-> {
 });
 frustration = new Button("Boredom");
 frustration.setStyle("-fx-font: 30 cornerstone; -fx-text-fill: black;");
 frustration.addEventHandler(ActionEvent.ACTION, (e)-> {
 });
 questions.add(SsubjectLabel,1,1);  
 questions.add(boredom,1,2); 
 questions.add(engagement,1,3); 
 questions.add(frustration,1,4); 
 questions.add(next,2,4);

这是我的代码一个带有两个gridPane的边框,在第二个窗格中我有按钮的问题。怎样才能代替按钮来获得比例答案?

1 个答案:

答案 0 :(得分:2)