Ejemplo n.º 1
0
  private void update() {
    details.addUpdate(newUpdate.getText());
    newUpdate.setText("");
    Data.setTaskDetails(task.getId(), details);

    workLog.setText(details.getWorkLog());
    workLog.setCaretPosition(details.getWorkLog().length());
  }
Ejemplo n.º 2
0
  private void createComponents() {
    this.setLayout(new BorderLayout());

    newUpdate.setFont(font);
    newUpdate.setLineWrap(true);
    newUpdate.setWrapStyleWord(true);
    newUpdate
        .getInputMap()
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK), "save");
    newUpdate
        .getActionMap()
        .put(
            "save",
            new AbstractAction() {
              private static final long serialVersionUID = -2895080236251258961L;

              @Override
              public void actionPerformed(ActionEvent arg0) {
                update();
              }
            });

    notes.setFont(font);
    notes.setLineWrap(true);
    notes.setWrapStyleWord(true);

    workLog.setEditable(false);
    workLog.setLineWrap(true);
    workLog.setFont(font);
    workLog.setWrapStyleWord(true);

    workLog.setText(details.getWorkLog());
    workLog.setCaretPosition(details.getWorkLog().length());
    notes.setText(details.getNotes());
    notes.setCaretPosition(0);

    if (details.getCloseTime() != 0) {
      update.setEnabled(false);
      notes.setEditable(false);
      newUpdate.setEditable(false);
      close.setText("Reopen Task");
    }
  }