0
votes

I have a javafx project and I want to create a questionnareis pane. In fact I want to create a scene with questions and answers. The answers should be a scale from 1-10 like here. Until now I have created a GridPane with the questions and buttons as answers but is there a better way to do so?

 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);

Here is my code one borderpane with two gridPane and in the second pane I have my questions with the buttons. How can instead of button to have a scale answer?

1
You would start by posting some of your code. Telling us to improve a UI that we can't see is a little bit like asking for the impossible. - GhostCat
Basically I think that the Jslider is what I need so I am trying to figure out how can replace the buttons with a single Jslider. - konstantin
@konstantin: JSlider a swing component. Slider is the appropriate JavaFX equivalent. Using swing nodes instead of JavaFX nodes in a JavaFX application wouldn't be good for the performance. - fabian

1 Answers