コード例 #1
0
  public EditDateTimeQuestionFrame(DateTimeQuestion dateTimeQuestion, SurveyPanel surveyPanel)
      throws IOException, ParseException {

    super(dateTimeQuestion, surveyPanel);
    this.dateTimeQuestion = dateTimeQuestion;

    this.setSize(600, 400);

    questionField.setText(question.getQuestion());
    hintField.setText(dateTimeQuestion.getHint());
    // errorMessageField.setText("");

    onlyDateBox = new JCheckBox("tylko data");
    onlyDateBox.setSelected(dateTimeQuestion.isOnlyDate());
    onlyDateBox.setBounds(FIELDS_X_POSITION, CURRENT_Y_POSITION, FIELDS_WIDTH, FIELDS_HEIGHT);
    this.add(onlyDateBox);

    CURRENT_Y_POSITION = CURRENT_Y_POSITION + FIELDS_HEIGHT + SPACE_HEIGHT;

    onlyTimeBox = new JCheckBox("tylko czas");
    onlyTimeBox.setSelected(dateTimeQuestion.isOnlyTime());
    onlyTimeBox.setBounds(FIELDS_X_POSITION, CURRENT_Y_POSITION, FIELDS_WIDTH, FIELDS_HEIGHT);
    this.add(onlyTimeBox);

    CURRENT_Y_POSITION = CURRENT_Y_POSITION + FIELDS_HEIGHT + SPACE_HEIGHT;

    saveButton.setBounds(
        ADD_BUTTON_X_POSITION, CURRENT_Y_POSITION + SPACE_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT);

    cancelButton.setBounds(
        CANCEL_BUTTON_X_POSITION, CURRENT_Y_POSITION + SPACE_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT);
  }
コード例 #2
0
 @Override
 protected Question saveQuestion() {
   question.setQuestion(questionField.getText());
   question.setHint(hintField.getText());
   // question.setErrorMessage(errorMessageField.getText());
   question.setObligatory(obligatoryBox.isSelected());
   dateTimeQuestion.setOnlyDate(onlyDateBox.isSelected());
   dateTimeQuestion.setOnlyTime(onlyTimeBox.isSelected());
   try {
     surveyPanel.refreshQuestionList();
   } catch (IOException ex) {
     Logger.getLogger(EditDateTimeQuestionFrame.class.getName()).log(Level.SEVERE, null, ex);
   } catch (ParseException ex) {
     Logger.getLogger(EditDateTimeQuestionFrame.class.getName()).log(Level.SEVERE, null, ex);
   }
   return null;
 }