I'm basically wanting to design a java questionaire gui (not on java) basically just a program that holds a bunch of questions and the corresponding correct answers. So the question i would imagine i would make appear on the label and then having four possible answers a b c and d as jbuttons. Then finally giving the user a score. I'm not really sure what the best way to do this is but i have searched high and low and cannot find a good piece of code to give me some ideas. My problem is everything i search in google about java questionaires etc it just gives me a million tests of java knowledge.

Have any of you guys built or seen any code that you could link me to ?

Thank you.

6 Years
Discussion Span
Last Post by stultuske

Some ideas:
Have the questions & answers in a file, not in the program.
Have two panels: One for the question and one for the answers.

I wrote a similar app. Here are some screen shots:

Attachments CorrectAnswer.png 13.82 KB WrongAnswer.png 13.81 KB

Wow thats way to advanced lol, but it looks great. You mean reading questions from a text file? How did you code the reverting to the Previous Question?


The questions and answers are all in files. Each line has a book number, question number, answer, the question and the 4 answers. Sample shown:

1	1	C	INLAND ONLY You are navigating in a narrow channel and must remain in the channel for safe operation.  Another vessel is crossing the channel ahead of you from your starboard and you doubt whether your vessel will pass safely.  Which statement is TRUE?	"You must stop your vessel, since the other vessel is the stand-on."	You must sound one short blast of the whistle and turn to starboard.	You must sound the danger signal.	You must stop your engines and you may sound the danger signal.

These are all read into some kind of collection like an ArrayList or Vector.
Then are accessed by an index number. As you progress thru the questions, you save the index number for each question. That way you have the index number for the previous question. The index number for the next question could either be the next one in line or it could be randomly generated to change the order of the questions for one usage to the next.

Edited by NormR1: n/a


pepee, this is not a "gimme codez" forum.
not to mention it's pretty pointless to revive a three year old thread to request it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.