Skip to content

Instantly share code, notes, and snippets.

@ojacobson
Created December 10, 2012 18:43
Show Gist options
  • Save ojacobson/4252421 to your computer and use it in GitHub Desktop.
Save ojacobson/4252421 to your computer and use it in GitHub Desktop.
public class QuizQuestion {
private final JLabel question;
public QuizQuestion(String question) {
this.question = new JLabel(question);
}
public void addToContainer(JComponent container) {
container.add(question);
}
}
/* ... */
List<QuizQuestion> questions = loadQuestions();
for (QuizQuestion question: questions) {
question.addToContainer(questionPanel);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment