Package java.awt

Examples of java.awt.FileDialog


    /**
     * Opens the load MIB dialog.
     */
    protected void loadMib() {
        FileDialog  dialog = new FileDialog(this, "Select MIB File");
        Loader      loader;
        String      file;
        File[]      files;

        dialog.setDirectory(currentDir.getAbsolutePath());
        dialog.setVisible(true);
        file = dialog.getFile();
        if (file != null) {
            files = new File[] { new File(dialog.getDirectory(), file) };
            currentDir = files[0].getParentFile();
            descriptionArea.setText("");
            loader = new Loader(files);
            loader.start();
        }
View Full Code Here


    if(lastDir == null)
      lastDir = new File(".");

    if(OsIdent.checkOStype() == OsIdent.OS_MACOSX)
    {
      FileDialog chooser = new FileDialog(WindowUtils.findParentFrame(c), title);
      System.setProperty("apple.awt.fileDialogForDirectories", "true");
      chooser.setDirectory(lastDir.getAbsolutePath());
      chooser.setMode(FileDialog.LOAD);
      chooser.setVisible(true);

      System.setProperty("apple.awt.fileDialogForDirectories", "false");
      if(chooser.getFile() != null)
      {
        String folderName = chooser.getDirectory();
        folderName += chooser.getFile();
        return new File(folderName);
      }
    }
    else
    {
      JFileChooser chooser = new JFileChooser(lastDir)
      {
        @Override
        protected JDialog createDialog(Component parent)
           throws HeadlessException
        {
          JDialog dlg = super.createDialog(parent);
          WindowUtils.fitAndCenterInScreen(dlg, 0.5f, 0.5f);
          return dlg;
        }
      };
      chooser.setDialogTitle(title);
      chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

      int returnVal = chooser.showDialog(c, approveButtonText);
      if(returnVal == JFileChooser.APPROVE_OPTION)
        return chooser.getSelectedFile();
    }

    return null;
  }
View Full Code Here

    if(lastDir == null)
      lastDir = new File(".");

    if(OsIdent.checkOStype() == OsIdent.OS_MACOSX)
    {
      FileDialog chooser = new FileDialog(WindowUtils.findParentFrame(c), title);
      System.setProperty("apple.awt.fileDialogForDirectories", "false");
      chooser.setDirectory(lastDir.getAbsolutePath());
      chooser.setMode(FileDialog.LOAD);

      if(filters != null)
        chooser.setFilenameFilter(new FilterWrapper(filters));

      chooser.setVisible(true);

      if(chooser.getFile() != null)
      {
        String folderName = chooser.getDirectory();
        folderName += chooser.getFile();
        return new File(folderName);
      }
    }
    else
    {
View Full Code Here

    if(lastDir == null)
      lastDir = new File(".");

    if(OsIdent.checkOStype() == OsIdent.OS_MACOSX)
    {
      FileDialog chooser = new FileDialog(WindowUtils.findParentFrame(c), title);
      System.setProperty("apple.awt.fileDialogForDirectories", "true");
      chooser.setDirectory(lastDir.getAbsolutePath());
      chooser.setMode(FileDialog.LOAD);

      if(filters != null)
        chooser.setFilenameFilter(new FilterWrapper(filters));

      chooser.setVisible(true);

      System.setProperty("apple.awt.fileDialogForDirectories", "false");
      if(chooser.getFile() != null)
      {
        String folderName = chooser.getDirectory();
        folderName += chooser.getFile();
        return new File(folderName);
      }
    }
    else
    {
View Full Code Here

    if(lastDir == null)
      lastDir = new File(".");

    if(OsIdent.checkOStype() == OsIdent.OS_MACOSX)
    {
      FileDialog chooser = new FileDialog(WindowUtils.findParentFrame(c), title);
      System.setProperty("apple.awt.fileDialogForDirectories", "false");
      chooser.setDirectory(lastDir.getAbsolutePath());
      chooser.setMode(FileDialog.SAVE);

      if(defName != null)
        chooser.setFile(defName);

      if(filters != null)
        chooser.setFilenameFilter(new FilterWrapper(filters));

      chooser.setVisible(true);

      if(chooser.getFile() != null)
      {
        String folderName = chooser.getDirectory();
        folderName += chooser.getFile();
        return new File(folderName);
      }
    }
    else
    {
View Full Code Here

      jButton_SendFile.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
          System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
         
          if(button_sendfile.getText().contains("Send")){
            FileDialog fileDialog = new FileDialog(dialog);
            fileDialog.setVisible(true);
            String file = fileDialog.getFile();
           
            String history = textArea.getText();
            history += "\n";
            history += "Send file to ";
            history += nodeInfo.getName();
View Full Code Here

  public static boolean workspacePopup() {
   
    if (System.getProperty("os.name").startsWith("Mac")) {
      String prop = "apple.awt.fileDialogForDirectories";
      System.setProperty(prop, "true");
      FileDialog fd = new FileDialog(frame, "Select assetes directory");
      fd.setVisible(true);
      workspace = fd.getDirectory()+fd.getFile();
      System.setProperty(prop, "false");

    } else {
      JFileChooser fc = new JFileChooser();
      fc.setDialogTitle("Select assetes directory");
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

    // 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

   *
   * @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

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.