Ejemplo n.º 1
0
 private void checkQuit() {
   int result =
       MyOptionPane.showConfirmDialog(
           null, "确认退出?", "系统提示", MyOptionPane.YES_NO_OPTION, MyOptionPane.QUESTION_MESSAGE);
   if (result == MyOptionPane.YES_OPTION) {
     System.exit(0);
   }
 }
Ejemplo n.º 2
0
    public void actionPerformed(ActionEvent e) {
      result = CANCEL_OPTION;

      String s = text.getText();
      String t = text2.getText();
      if (!(t.equals(""))) s += File.separator + t;
      File f = new File(s);
      if (f.isDirectory()) {
        if (f.list().length > 0) {
          MyOptionPane.showMessageDialog(driver.frame, "Folder not empty - cannot be deleted");

          return;
        }
      } else {
        if (driver.curDiag.diagramIsOpen(s)) {
          MyOptionPane.showMessageDialog(driver.frame, "File cannot be deleted while open");

          return;
        }
      }

      String u = f.isDirectory() ? "folder" : "file";

      if (JOptionPane.YES_OPTION
          == MyOptionPane.showConfirmDialog(
              frame,
              "Do you want to delete this " + u + ": " + f.getName() + "?",
              "File/folder delete",
              JOptionPane.YES_NO_OPTION)) {

        listHead = f.getParent();
        f.delete();
        // fullNodeName = listHead.getAbsolutePath();
        // showFileNames();
        text.setText(listHead);
        // panel.remove(listView);
        showList();
      }
      frame.repaint();
    }