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...