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); }
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; }