Beispiel #1
0
 public Quiz getQuizFromContents() {
   List<Question> questions = new ArrayList<Question>();
   for (QuestionEditor editor : questionEditorList) {
     questions.add(editor.getQuestionFromContents());
   }
   return new Quiz(titleTxt.getText(), authorTxt.getText(), questions);
 }
Beispiel #2
0
 public boolean verify(JComponent input) {
   if (input instanceof JFormattedTextField) {
     JFormattedTextField ftf = (JFormattedTextField) input;
     JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
     if (formatter != null) {
       String text = ftf.getText();
       try {
         formatter.stringToValue(text);
         return true;
       } catch (ParseException pe) {
         return false;
       }
     }
   }
   return true;
 }