【发布时间】:2016-07-20 21:54:36
【问题描述】:
我有一个 javafx 项目,我想创建一个问卷调查窗格。事实上,我想创建一个有问题和答案的场景。答案应该是从 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,在第二个窗格中我对按钮有疑问。怎么能代替按钮有一个规模的答案?
【问题讨论】:
-
您将从发布您的一些代码开始。告诉我们改进我们看不到的 UI 有点像要求不可能的事情。
-
基本上我认为 Jslider 是我需要的,所以我想弄清楚如何用单个 Jslider 替换按钮。
-
@konstantin:
JSlider一个摆动组件。Slider是适当的 JavaFX 等效项。在 JavaFX 应用程序中使用 swing 节点而不是 JavaFX 节点对性能没有好处。