Exemple #1
0
  public void newItem() {
    Date dtn = new Date();
    SimpleDateFormat formatter1 = new SimpleDateFormat("dd.MM.yyyy HH-mm");
    String dt = formatter1.format(dtn);
    KOptionPane.showInputDialog(
        ctx.getRootContainer(),
        i18n.getString("new_note_name"),
        dt,
        new InputDialogListener() {

          public void onClose(String arg0) {
            if (arg0 == null) return;
            File file = new File(ctx.getHomeDirectory(), arg0 + ".txt");
            if (!file.exists()) {
              try {
                file.createNewFile();
                addHomeItem(arg0, 0);
              } catch (IOException e) {
                e.printStackTrace();
              }
            }
            openAndEditFile(arg0);
          }
        });
  }