Package java.awt

Examples of java.awt.FileDialog


    // folder selector?
    if (folder) {
      return super.openDialog(multiple, folder, filter);
    }
   
    final FileDialog d = new FileDialog(new Frame(), "", FileDialog.LOAD);
    d.setVisible(true);
    if (d.getFile() != null) {
      File f = new File(d.getDirectory(), d.getFile());
      // is typ ok?
      if (folder && !f.isDirectory()) {
        f = f.getParentFile();
      }
     
View Full Code Here


   * Open the dialog to load an file, swing based
   *
   * @return the file or null
   */
  @Override public File saveDialog() {
    final FileDialog d = new FileDialog(new Frame(), "", FileDialog.SAVE);
    d.setVisible(true);
    if (d.getFile() != null) {
      return new File(d.getDirectory(), d.getFile());
    }
    return null;
  }
View Full Code Here

        if (dlg.show().equals(TaskDialog.StandardCommand.CANCEL)) {
          System.exit(0);
        }

        FileDialog f = new FileDialog(new JDialog());
        f.setVisible(true);
        path = new File(f.getDirectory());

        // check path
        if (path == null || !path.canRead()) {
          TaskDialogs.error(null, I18N.t("Can not read from {0}", path),
              I18N.t("{0} can't read the folder {1} and will exit.", YrgssCore.TITLE, path));
View Full Code Here

    setLocation(100, 100);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }

  private void openDialog() {
    FileDialog fd = new FileDialog(this, "Open", FileDialog.LOAD);
    fd.setVisible(true);
    String dir = fd.getDirectory();
    String file = fd.getFile();
    if (dir != null && file != null) {
      open(dir + File.separator + file);
    }
  }
View Full Code Here

    }

    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      if (fileDialog == null) {
        fileDialog = new FileDialog(frame);
      }
      fileDialog.setMode(FileDialog.LOAD);
      fileDialog.setVisible(true);

      String file = fileDialog.getFile();
View Full Code Here

    }

    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      if (fileDialog == null) {
        fileDialog = new FileDialog(frame);
      }
      //System.out.println("Name:"+file.getName()+" Dir:"+file.getParent());
      fileDialog.setMode(FileDialog.SAVE);
      fileDialog.setFile(file.getName());
      fileDialog.setDirectory(file.getParent());
View Full Code Here

    * @param defDir the directory
    * @param fileType the file type
    * @return the string
    */
   public String loadFile(Frame f, String title, String defDir, String fileType) {
     FileDialog fd = new FileDialog(f, title, FileDialog.LOAD);
     fd.setFile(fileType);
     fd.setDirectory(defDir);
     fd.setLocation(50, 50);
     fd.show();
     return fd.getDirectory()+fd.getFile();
   }
View Full Code Here

    * @param defDir the directory
    * @param fileType the file type
    * @return the string
    */
   public String saveFile(Frame f, String title, String defDir, String fileType) {
     FileDialog fd = new FileDialog(f, title, FileDialog.SAVE);
     fd.setFile(fileType);
     fd.setDirectory(defDir);
     fd.setLocation(50, 50);
     fd.show();
     return fd.getDirectory()+fd.getFile();
   }
View Full Code Here

    * @param defDir the def dir
    * @param fileType the file type
    * @return the string
    */
   public String loadFile(Frame f, String title, String defDir, String fileType) {
     FileDialog fd = new FileDialog(f, title, FileDialog.LOAD);
     fd.setFile(fileType);
     fd.setDirectory(defDir);
     fd.setLocation(50, 50);
     fd.show();
     return fd.getDirectory()+fd.getFile();
   }
View Full Code Here

    * @param defDir the def dir
    * @param fileType the file type
    * @return the string
    */
   public String saveFile(Frame f, String title, String defDir, String fileType) {
     FileDialog fd = new FileDialog(f, title, FileDialog.SAVE);
     fd.setFile(fileType);
     fd.setDirectory(defDir);
     fd.setLocation(50, 50);
     fd.show();
     return fd.getDirectory()+fd.getFile();
   }
View Full Code Here

TOP

Related Classes of java.awt.FileDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.