javax.swing.JFileChooser.approveSelection()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中javax.swing.JFileChooser.approveSelection()方法的一些代码示例,展示了JFileChooser.approveSelection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.approveSelection()方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:approveSelection

JFileChooser.approveSelection介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

@Override
public void approveSelection() {
  if (approver != null) {
    File[] selected = getSelectedFiles();
    final File sf = getSelectedFile();
    if ((selected == null || selected.length == 0) && sf != null) {
      selected = new File[] { sf };
    }
    boolean approved = approver.approve(selected);
    if (approved) {
      super.approveSelection();
    }
  } else {
    super.approveSelection();
  }
}

代码示例来源:origin: apache/pdfbox

@Override
  public void approveSelection()
  {
    File selectedFile = getSelectedFile();
    if (selectedFile.exists() && getDialogType() == JFileChooser.SAVE_DIALOG)
    {
      int result = JOptionPane.showConfirmDialog(this,
        "Do you want to overwrite?",
        "File already exists",
        JOptionPane.YES_NO_OPTION);
      if (result != JOptionPane.YES_OPTION)
      {
        cancelSelection();
        return;
      }
    }
    super.approveSelection();
  }
};

代码示例来源:origin: ron190/jsql-injection

@Override
  public void approveSelection() {
    File file = this.getSelectedFile();
    if (file.exists() && this.getDialogType() == JFileChooser.SAVE_DIALOG) {
      int replace = JOptionPane.showConfirmDialog(
        this,
        file.getName() +" "+ I18n.valueByKey("LIST_EXPORT_CONFIRM_LABEL"),
        I18n.valueByKey("LIST_EXPORT_CONFIRM_TITLE"),
        JOptionPane.YES_NO_OPTION
      );
      switch (replace) {
        case JOptionPane.YES_OPTION:
          super.approveSelection();
          return;
        case JOptionPane.NO_OPTION:
        case JOptionPane.CLOSED_OPTION:
          return;
        case JOptionPane.CANCEL_OPTION:
          this.cancelSelection();
          return;
        default:
          break;
      }
    } else {
      super.approveSelection();
    }
  }
};

代码示例来源:origin: ron190/jsql-injection

@Override
public void approveSelection() {
  File file = this.getSelectedFile();
  if (this.getDialogType() == SAVE_DIALOG) {
    if (file.exists()) {
      int result = JOptionPane.showConfirmDialog(
        this,
        this.getSelectedFile().getName() + " " + I18n.valueByKey("SAVE_TAB_CONFIRM_LABEL"),
        I18n.valueByKey("SAVE_TAB_CONFIRM_TITLE"),
        JOptionPane.YES_NO_OPTION
      );
      switch (result) {
        case JOptionPane.YES_OPTION:
          super.approveSelection();
          return;
        case JOptionPane.NO_OPTION:
        case JOptionPane.CLOSED_OPTION:
          return;
        case JOptionPane.CANCEL_OPTION:
          this.cancelSelection();
          return;
        default:
          break;
      }
    } else {
      super.approveSelection();
    }
  }
}

代码示例来源:origin: geotools/geotools

super.approveSelection();

代码示例来源:origin: org.gephi/desktop-io-export

@Override
  public void approveSelection() {
    if (canExport(this)) {
      super.approveSelection();
    }
  }
};

代码示例来源:origin: org.gephi/desktop-io-export

@Override
  public void approveSelection() {
    if (canExport(this)) {
      super.approveSelection();
    }
  }
};

代码示例来源:origin: com.l2fprod.common/l2fprod-common-directorychooser

public void actionPerformed(ActionEvent e) {
  setSelectedFiles();
  chooser.approveSelection();
 }
}

代码示例来源:origin: igvteam/igv

public void approveSelection() {
  accepted = true;
  super.approveSelection();
}

代码示例来源:origin: robotframework/SwingLibrary

@Override
public void approveSelection() {
  super.approveSelection();
  cancelled = false;
  File selected = super.getSelectedFile();
  if (selected != null) {
    selectedFilePath = selected.getAbsolutePath();
  }
}

代码示例来源:origin: net.java.linoleum/application

@Override
public void approveSelection() {
  returnValue = APPROVE_OPTION;
  if (dialog != null) {
    hide(dialog);
  }
  super.approveSelection();
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-ant-ui

@Override
public void approveSelection() {
  if (accessory != null && !accessory.canApprove()) {
    return;
  }
  super.approveSelection();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-core-ui

@Override
 public void approveSelection() {
  if (validator != null) {
   String msgError = validator.validate(getSelectedFile().getPath());
   if (msgError != null) {
    JOptionPane.showMessageDialog(this, msgError);
    return;
   }
  }

  super.approveSelection();
 }
}

代码示例来源:origin: lbalazscs/Pixelitor

@Override
  public void approveSelection() {
    File f = getSelectedFile();
    if (f.exists()) {
      String msg = f.getName() + " exists already. Overwrite?";
      if (!Dialogs.showYesNoQuestionDialog(this, "Confirmation", msg)) {
        return;
      }
    }
    super.approveSelection();
  }
}

代码示例来源:origin: ata4/bspsrc

@Override
public void approveSelection() {
  File file = getSelectedFile();
  if (file != null && !file.exists()) {
    showFileNotFoundDialog();
    return;
  }
  super.approveSelection();
}

代码示例来源:origin: ata4/bspsrc

@Override
public void approveSelection() {
  File file = getSelectedFile();
  if (file != null && file.exists() && !askOverwrite(file)) {
    return;
  }
  super.approveSelection();
}

代码示例来源:origin: worstcase/gumshoe

public void approveSelection() {
  closeParser();
  openParser(getSelectedFile());
  notifyContentsChanged();
  super.approveSelection();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv81

public void approveSelection() {
  File dir = FileUtil.normalizeFile(getSelectedFile());
  String mess = Util.rootOfUsableDomain(dir);
  if (null == mess) {
    super.approveSelection();
  }
  else {
    setCurrentDirectory( dir );
  }
  
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv81

public void approveSelection() {
  File dir = FileUtil.normalizeFile(getSelectedFile());
  
  if ( ServerLocationManager.isGoodAppServerLocation(dir) ) {
    super.approveSelection();
  } else {
    setCurrentDirectory( dir );
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2me-cdc-project

public void approveSelection() {
      File dir = FileUtil.normalizeFile(getSelectedFile());
      if ( dir != null && ImportCDCProjectPanel.isOldProject( FileUtil.toFileObject(dir),ImportCDCProjectPanel.prjType) ) {
        super.approveSelection();
      }
      else {
        setCurrentDirectory( dir );
      }
    }
}

相关文章

JFileChooser类方法