Examples of FileDialog


Examples of java.awt.FileDialog

  Thread cl = new EjectThread();
  cl.start();
    }

    public void doEject() {
  FileDialog fd;
  close();
  // Block till we receive ControllerClosedEvent
  while (player != null) {
      try {
    Thread.sleep(100);
      } catch (InterruptedException ie) {
      }
  }
  fd = new FileDialog(frame, "Open File", FileDialog.LOAD);
  if (lastDir != null)
      fd.setDirectory(lastDir);
  fd.show();
  lastDir = fd.getDirectory();
  String filename = fd.getFile();
  if (filename == null)
      return;
  else {
      loadMovie(lastDir + filename);
  }
  fd.dispose();
    }
View Full Code Here

Examples of java.awt.FileDialog

  ActionListener al = new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
    String command = ae.getActionCommand();
    if (command.equals("Open")) {
        if (fd == null) {
      fd = new FileDialog(MDIApp.this, "Open File",
                   FileDialog.LOAD);
      fd.setDirectory("/movies");
        }
        fd.show();
        if (fd.getFile() != null) {
View Full Code Here

Examples of java.awt.FileDialog

                    exit();

                    return;
                }
            } else {
                FileDialog f = new FileDialog(fMain, "Restore FileName",
                                              FileDialog.LOAD);

                f.show();

                String sFileName = f.getFile();
                String Path      = f.getDirectory();

                if ((sFileName == null) || (sFileName.equals(""))) {
                    exit();

                    return;
                } else {
                    sourceDb = new TransferSQLText(Path + sFileName, this);
                }
            }

            if ((iTransferMode == TRFM_RESTORE)
                    || (iTransferMode == TRFM_TRANSFER)) {
                targetDb = new TransferDb(
                    ConnectionDialog.createConnection(
                        fMain, "Target Database"), this);

                if (!targetDb.isConnected()) {
                    exit();

                    return;
                }
            } else {
                FileDialog f = new FileDialog(fMain, "Dump FileName",
                                              FileDialog.SAVE);

                f.show();

                String sFileName = f.getFile();
                String Path      = f.getDirectory();

                if ((sFileName == null) || (sFileName.equals(""))) {
                    exit();

                    return;
View Full Code Here

Examples of java.awt.FileDialog

        } else if (s.equals("Insert 1000 rows only")) {
            iMaxRows = 1000;
        } else if (s.equals("Insert all rows")) {
            iMaxRows = 0;
        } else if (s.equals("Load Settings...")) {
            FileDialog f = new FileDialog(fMain, "Load Settings",
                                          FileDialog.LOAD);

            f.show();

            String file = f.getDirectory() + f.getFile();

            if (file != null) {
                LoadPrefs(file);
                displayTable(tCurrent);
            }
        } else if (s.equals("Save Settings...")) {
            FileDialog f = new FileDialog(fMain, "Save Settings",
                                          FileDialog.SAVE);

            f.show();

            String file = f.getDirectory() + f.getFile();

            if (file != null) {
                SavePrefs(file);
            }
        } else if (s.equals("Exit")) {
View Full Code Here

Examples of java.awt.FileDialog

  private String showFileDialog(View               parentView,
                                String             dialogTitle,
                                final ContentType  contentType,
                                String             name,
                                boolean            save) {
    FileDialog fileDialog = new FileDialog(
        JOptionPane.getFrameForComponent((JComponent)parentView));

    // Set selected file
    if (save && name != null) {
      fileDialog.setFile(new File(name).getName());
    }
   
    // Set supported files filter
    fileDialog.setFilenameFilter(new FilenameFilter() {
        public boolean accept(File dir, String name) {         
          return isAcceptable(new File(dir, name).toString(), contentType);
        }
      });
    // Update current directory
    if (this.currentDirectory != null) {
      fileDialog.setDirectory(this.currentDirectory.toString());
    }
    if (save) {
      fileDialog.setMode(FileDialog.SAVE);
    } else {
      fileDialog.setMode(FileDialog.LOAD);
    }

    if (dialogTitle == null) {
      dialogTitle = getFileDialogTitle(save);
    }
    fileDialog.setTitle(dialogTitle);
   
    fileDialog.setVisible(true);
    String selectedFile = fileDialog.getFile();
    // If user chose a file
    if (selectedFile != null) {
      // Retrieve current directory for future calls
      this.currentDirectory = new File(fileDialog.getDirectory());
      // Return selected file
      return this.currentDirectory + File.separator + selectedFile;
    } else {
      return null;
    }
View Full Code Here

Examples of java.awt.FileDialog

            pResult.removeAll();
            pResult.add("Center", gResult);
            pResult.doLayout();
        } else if (s.equals("Open Script...")) {
            FileDialog f = new FileDialog(fMain, "Open Script",
                                          FileDialog.LOAD);

            // (ulrivo): set default directory if set from command line
            if (defDirectory != null) {
                f.setDirectory(defDirectory);
            }

            f.show();

            String file = f.getFile();

            if (file != null) {
                StringBuffer buf = new StringBuffer();

                ifHuge = DatabaseManagerCommon.readFile(f.getDirectory()
                        + file);

                if (4096 <= ifHuge.length()) {
                    buf.append(
                        "This huge file cannot be edited.\n Please execute or clear\n");
                    txtCommand.setText(buf.toString());
                } else {
                    txtCommand.setText(ifHuge);
                }
            }
        } else if (s.equals("Save Script...")) {
            FileDialog f = new FileDialog(fMain, "Save Script",
                                          FileDialog.SAVE);

            // (ulrivo): set default directory if set from command line
            if (defDirectory != null) {
                f.setDirectory(defDirectory);
            }

            f.show();

            String file = f.getFile();

            if (file != null) {
                DatabaseManagerCommon.writeFile(f.getDirectory() + file,
                                                txtCommand.getText());
            }
        } else if (s.equals("Save Result csv...")) {
            FileDialog f = new FileDialog(fMain, "Save Result CSV",
                                          FileDialog.SAVE);

            // (ulrivo): set default directory if set from command line
            if (defDirectory != null) {
                f.setDirectory(defDirectory);
            }

            f.show();

            String dir  = f.getDirectory();
            String file = f.getFile();

            if (dir != null) {
                file = dir + "/" + file;
            }

            if (file != null) {
                showResultInText();
                saveAsCsv(file);
            }
        } else if (s.equals("Save Result...")) {
            FileDialog f = new FileDialog(fMain, "Save Result",
                                          FileDialog.SAVE);

            // (ulrivo): set default directory if set from command line
            if (defDirectory != null) {
                f.setDirectory(defDirectory);
            }

            f.show();

            String file = f.getFile();

            if (file != null) {
                showResultInText();
                DatabaseManagerCommon.writeFile(f.getDirectory() + file,
                                                txtResult.getText());
            }
        } else if (s.equals("Results in Text")) {
            iResult = 1;
View Full Code Here

Examples of net.sf.kpex.gui.builtins.FileDialog

    register(new NewFrame());
    register(new NewButton());
    register(new NewLabel());
    register(new SetLabel());
    register(new Dialog());
    register(new FileDialog());
    register(new NewPanel());
    register(new NewColor());
    register(new SetFg());
    register(new SetBg());
    register(new SetColor());
View Full Code Here

Examples of nz.govt.natlib.meta.ui.FileDialog

  }

  private void saveViewModel() {
    // create and open a fileDialog
    JDialog fileDialog = new JDialog(this, "Open File", true);
    FileDialog filePanel = new FileDialog(this, this, true, false, false);
    fileDialog.getContentPane().add(filePanel);
    fileDialog.pack();

    // set the location.
    Point p1 = this.getLocation();
    Dimension d1 = this.getSize();
    Dimension d2 = fileDialog.getSize();
    fileDialog.setLocation((p1.x + (d1.width / 2)) - (d2.width / 2),
        (p1.y + (d1.height / 2)) - (d2.height / 2));

    filePanel.setCurrentDirectory(Config.getInstance().getBaseHarvestDir());
    fileDialog.show();
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.FileDialog

    return composite;
  }

  private void handleBrowse() {
    FileDialog dialog = new FileDialog(getShell(), SWT.SINGLE);
    dialog.setText("Select file");
    dialog.setFilterExtensions(new String[] { "*.zip", "*.wgaplugin" });
    String selectedFile = dialog.open();
    if (selectedFile != null) {
      String[] fileNames = dialog.getFileNames();
      File dir = new File(dialog.getFilterPath());
      if (fileNames.length > 0) {   
        _tmplFile.setText(new File(dir, fileNames[0]).getAbsolutePath());
      }
    }
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.FileDialog

    Messages.setLanguageText(browse, "exportTorrentWizard.exportfile.browse");
    browse.addListener(SWT.Selection,new Listener() {
     
      public void handleEvent(Event arg0){
       
      FileDialog fd = new FileDialog(wizard.getWizardWindow(), SWT.SAVE );
     
      fd.setFileName(textPath.getText());
     
      fd.setFilterExtensions(new String[]{"*.xml", Constants.FILE_WILDCARD});
     
      String path = fd.open();
     
      if(path != null) {
       
        textPath.setText(path);
      }    
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.