0

I'm creating a feedback app, it takes user feedbacks it has few questions ask from the user. According to my approach Feedback class has a method called runfeedback() when this method is called it's instantiating an object of Question class passing the questions and its answers. Question class has a method called generateUI() which needs to return the answer given by the user. This return value is collected with int Feedback class object. Here's in brief of the above case :

    public class Feedback{

      public void runfeedback(){

//Array list to collect answers from the user

          List<String> answerList = new ArrayList<>();

  //Creating a question from question class

           Question q1 = new Question("What is your rating for the 
           program?",new String[]{"1","2","3","4","5"}); 


//Creating a question from question class
               Question q2 = new Question("How do you think about the speaker?",new String[]{"Bad","Good","Very Good","Excellent"});

answerList.add(q1.generateUI());// Here the UI is generated dynamically according to the above-given parameters in the question object and wait for the user to respond and not going to the next line... 
answerList.add(q2.generateUI());

//Do other stuffs or create new questions !

....
}



}

According to the above code I want to go to the next question only once the user enter their feedback of skipped. For this I have two buttons in the UI generated by the method generateUI(), this method is just generating a new window with set of elements according to the question. Anodther thing is I need to add a timer to each of this question and dont invoke next generateUI() untill timeout.

How can I achieve this waiting of user inputs and the timer ?

Here the UI I have dynamically generated from the generateUI() method...used the swing to achieve this... enter image description here

  • [Just for some food for thought](https://stackoverflow.com/questions/31602113/listener-placement-adhering-to-the-traditional-non-mediator-mvc-pattern/31604919#31604919) - which is an implementation of "quiz" based API using a MVC – MadProgrammer Oct 29 '18 at 03:45
  • [Slightly different](https://stackoverflow.com/questions/30925564/why-is-my-jlabel-not-showing-up/30926625#30926625) but presents a quiz with a "timeout" – MadProgrammer Oct 29 '18 at 03:47
  • @MadProgrammer yes kinda related to that ... I have to actions one is time out the other one is when the user clicks next interpret it nag execute the next – Dileepa Rajapaksa Oct 29 '18 at 04:05

0 Answers0