Package java.awt

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


  int currentPos = 0;
 
  String selectFolder() {

    System.setProperty("apple.awt.fileDialogForDirectories", "true");
    FileDialog fd = new FileDialog(GLOBAL.applet.frame, "open",
        FileDialog.LOAD);
    String currentDir = new File(".").getAbsolutePath();
    fd.setLocation(50, 50);
    fd.pack();

    fd.show();
    System.setProperty("apple.awt.fileDialogForDirectories", "false");

    if (fd.getDirectory() != null) {
      return fd.getDirectory() + fd.getFile();
    } else {
      return "";
    }

  }
View Full Code Here

  }

  public void openEnvironmentFromFile(GUIEvent e) {
    LOGGER.info("Preparing to open SketchChair file.");

    FileDialog fd = new FileDialog(GLOBAL.applet.frame, "open",
        FileDialog.LOAD);
    fd.setFile("chair" + SETTINGS.chairSaveNum + ".png");
    String currentDir = new File(".").getAbsolutePath();
    fd.setDirectory(currentDir + "\\savedChairs\\");
    /*
    fd.setFilenameFilter(new FilenameFilter(){
      public boolean accept(File directory, String filename)
      {
      return (filename.endsWith("*.cha"));
      }
      });
    */
    fd.setLocation(50, 50);
    fd.pack();

    fd.show();

    //System.out.println(fd.getDirectory() +fd.getFile());
    if (fd.getName() != null) {
      String filename = fd.getFile();

      LOGGER.info("Loading: " + fd.getDirectory() + filename);

      Environment environment = new Environment(fd.getDirectory()
          + filename, GLOBAL.applet);
      this.l.add(environment);

    } else {
      // println("not an stl file");
View Full Code Here

     * @return java.awt.FileDialog
     */
    private FileDialog getFileDialog() {
        if (iFileDialog == null) {
            try {
                iFileDialog = new FileDialog(this);
                iFileDialog.setName("FileDialog");
                iFileDialog.setLayout(null);
                centerDialog(iFileDialog);
            } catch (Throwable iExc) {
                handleException(iExc);
View Full Code Here

    }

    public static void saveToFile(final String saveDialogTitle, final String title, final String text) {
        final Frame parent = new Frame();

        final FileDialog dialog = new FileDialog(parent, saveDialogTitle, FileDialog.SAVE);
        dialog.setVisible(true);
        final String file = dialog.getFile();
        final String dir = dialog.getDirectory();

        parent.dispose();

        saveToFile(new File(dir, file), title, text);
    }
View Full Code Here

        super.setTitle(str);
    }

    @Override
    public String selectFilePath(final String title, final String directory) {
        final FileDialog dlg = new FileDialog(this, title);
        dlg.setVisible(true);

        final String path = dlg.getDirectory() + dlg.getFile();
        return path;
    }
View Full Code Here

     * @return java.awt.FileDialog
     */
    private FileDialog getFileDialog() {
        if (iFileDialog == null) {
            try {
                iFileDialog = new FileDialog(this);
                iFileDialog.setName("FileDialog");
                iFileDialog.setLayout(null);
                centerDialog(iFileDialog);
            } catch (Throwable iExc) {
                handleException(iExc);
View Full Code Here

    private static final int CDN_INCLUDEITEM = CDN_FIRST - 0x0007;
   
    private static class OFNHookHandler implements Handler {
       
        public long windowProc(long hwnd, int msg, long wParam, long lParam) {
            FileDialog fd = thread2fd.get(Thread.currentThread());
            if (fd == null) {
                return 0l;
            }
            FilenameFilter ff = fd.getFilenameFilter();
           
            if (msg == WM_INITDIALOG) {
                WinFileDialog.getInstance(fd).hwnd = win32.GetParent(hwnd);
            }
            if (msg != WM_NOTIFY) {
View Full Code Here

    test3(harness);
  }
 
  public void test1(TestHarness harness)
  {
    FileDialog fd = new FileDialog(new Frame());
    fd.setFile("String");
    harness.check(fd.getFile(), "String");
  }
View Full Code Here

    harness.check(fd.getFile(), "String");
  }
 
  public void test2(TestHarness harness)
  {
    FileDialog fd = new FileDialog(new Frame());
    fd.setFile(null);
    harness.check(fd.getFile(), 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.