Menu

Home

CreepyMulder

Presentation of JQuizz

What is it ?

JQuizz is a toolkit to easily create swing based multiple choice questions (or Quizz). It tries his best
to make your life easier by making you focus only on the actual content of your quizz, and not spending time
on the machinery.

What does it look like ?

With the default graphic settings, you can easily obtains something like this :

img

You can set up the maximum number of choices the user can select, and if this number is reached, the other
choices will be greyed out.

A result page will also be generated :

img

By default, a correctly answered question will be displayed in green, with the correct choices in bold, and an
uncorrectly answered question will be displayed in red, with the correct answers in green/bold, and the user's
answers underlined.

An explanation of the answer can be set and will be displayed at the bottom of the question in the result page.

If the user got all the right answers, he gain a point, and if he made any mistake, he doesn't get one.

How can I use it ?

After adding the packages in your project, you just have to instanciate a QuizzDataEntry object, specify the data,
create a Quizz object with the QuizzDataEntry object as a parameter, and put the Quizz object in the content pane.

See the following example :

//We instanciate a QuizzDataEntry to enter the data
QuizzDataEntry quizzData = new QuizzDataEntry(); 

quizzData.setNumberOfQuestions(3); //Number of questions in the quizz
quizzData.setMainTitle("Quizz 1 : Random stuff"); //Set the main title of the quizz
//Set the title of the result window
quizzData.setResultTitle("Result of Quizz 1 : Random stuff"); 

//Select the question 1
quizzData.selectQuestion(1); 

//Set the title of the question
quizzData.setTitle("Question 1 : What do cats really like ?");

//Set the choices
quizzData.addChoices(1, "World domination");
quizzData.addChoices(2, "Being a good pet");
quizzData.addChoices(3, "Taking a bath");
quizzData.addChoices(4, "Killing birds");
quizzData.addChoices(5, "Dogs");

quizzData.setCorrectAnswers(1,4); //The choices 1 and 4 will be the correct answers
quizzData.setNumberOfAnswers(2); //The user can only select two answers at the same time
            //If this is not set, the user will be able to select all the answers

//(Optional) Set an explanation that will be displayed in the result window
quizzData.setExplanation("Cats strive for world domination, their 
                       first step is to kill air support : birds."); 

//Select the question 2, and so on !
quizzData.selectQuestion(2);

[...]

//Instanciate a Quizz object with a QuizzDataEntry object as a parameter, 
//and put it in your contentPane
Quizz quizz = new Quizz(quizzData);
setContentPane(quizz);

There are some Exceptions in place that will stop the thread if they are illogical in put (like selecting question
number 9999).

If you wish to create multiple Quizz inside the same application, you may wish to use the .resetText() method
inside the ResultWindow class, that will erase the content of the variable that contains the whole correction's text,
because otherwise it will just keep adding text and each completed quizz.

(!) Note that the windows are designed to be correctly displayed on a 800*600 JFrame with 5 choices at most. If you want
to add more choices or display the quizz in a bigger/smaller window, you may have to modify some graphic
options as described below.

Where can I modify the graphic options ?

This part is not really user friendly at the moment. In the package jquizz.quizzdesign, you have two classes :

  • QuestionWindow.java : Represent a typical window for a question
  • ResultWindow.java : Represent the result window

Each of them have a placeElements() methods that contains all the graphics property, it's up to you to mess with them.

Known issues and Todo-list

There's a few things I'm thinking about :

  • It's not possible at the moment to use a completely different QuestionWindow or ResultWindow if there
    are multiple Quizzs.
  • Pulling data from a database or files would be cool.
  • More user-friendly stuff to change the graphics
  • More checks for inconsistent data.
  • Any ideas ?

MongoDB Logo MongoDB