I have a QuizApplication which will show up the results upon user finished the test. I have following piece of code which returns quiz result as string:
public String getResult() {
int score = 0;
String[] choices;
String scoreB = "";
for (int i = 0; i < test.length; i++) {
if (test[i].getCorrect() == test[i].getAns()) {
score++;
} else {
choices = test[i].getChoice();
scoreB += "Question " + (i + 1) + " : " + test[i].getQn() + "\n<html></br>choices[test[i].getCorrect() - 1] + "\n\n";
}
} // end of for loop
return result;
}
And then I want to show the result in the form of MessageDialog, so I used:
JOptionPane.showMessageDialog(null, newQuiz.getResult()
But, I want to add a vertical scrollbar onto the JOptionPane.showMessageDialog
. How can I do it?