0

I am trying to create a simple multiple choice quiz in java with netbeans. I have begun making the quiz by having a new jframe for every question, however, I know there are better ways to do this since I have quite a lot of questions. I am wondering if there is a way I can have only one question jframe and then change the text of the jlabel with the question and the buttons with the answers. I will need to check if the answer is correct then make a message saying whether or not it is correct.

  • 1
    Always good to post code and a verifiable example. Please read about how to ask good questions on stack – Claire May 13 '18 at 06:23
  • Your intention should be to have only one form which would act as the primary view for any question. You would then "model" the quiz. This allows you to pass a "question" to the UI and the UI should be able to use it to setup how it will be displayed. Something like [this for example](https://stackoverflow.com/questions/31602113/listener-placement-adhering-to-the-traditional-non-mediator-mvc-pattern/31604919#31604919) or [this for example](https://stackoverflow.com/questions/30925564/why-is-my-jlabel-not-showing-up/30926625#30926625) – MadProgrammer May 13 '18 at 06:23
  • The question is some what subjective and invites opinion. My suggestion is to start without the ui in mind. Instead, focus on the data - how are the questions managed? How is the score managed? How are the answers managed? How would you iterate through the questions? To you want to support bi-directional navigation? If you can answer those questions (and define structures to support them) you’re about 80% of the way there – MadProgrammer May 13 '18 at 06:31
  • Hello and welcome to StackOverflow. Please take some time to read the help page, especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask). And more importantly, please read [the Stack Overflow question checklist](http://meta.stackexchange.com/q/156810/204922). You might also want to learn about [Minimal, Complete, and Verifiable Examples](http://stackoverflow.com/help/mcve). – lexicore May 13 '18 at 08:42
  • Why your question is not quite good: you are asking "is implementing possible?". A valid answer to that is *yes*, period. But this does not help you. Your next question will probably be "how do I implement it" and a valid answer to that is "by writing code". Please post a specific question if you have some specific difficulty. – lexicore May 13 '18 at 08:44

0 Answers0