Package java.awt

Examples of java.awt.FileDialog


    tomcatLocationPathTextField.addCaretListener(tomcatLocationPathCaretListener);

    tomcatLocationPathButton.setText("Browse...");
    tomcatLocationPathButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        FileDialog dialog = new FileDialog(PreferencesView.this, "Select Tomcat Folder", FileDialog.LOAD);
        System.setProperty("apple.awt.fileDialogForDirectories", "true");
        dialog.setVisible(true);
        System.setProperty("apple.awt.fileDialogForDirectories", "false");
        if (dialog.getDirectory() != null) {
          tomcatLocationPathTextField.setText(dialog.getDirectory() + dialog.getFile());
        }
      }
    });

    tomcatLocationPathExplanationLabel = new JLabel();
    {
      GridBagConstraints constraints = new GridBagConstraints();
      constraints.gridx = 1;
      constraints.gridy = ++currentGridY;
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.insets.left = 5;
      constraints.insets.bottom = 5;
      contentPanel.add(tomcatLocationPathExplanationLabel, constraints);
    }
    tomcatLocationPathExplanationLabel.setFont(new Font("Lucida Grande", 0, 11));
    tomcatLocationPathExplanationLabel.setText("The path to the Tomcat installation root folder");

    // java home path
    javaHomePathLabel = new JLabel();
    {
      GridBagConstraints constraints = new GridBagConstraints();
      constraints.gridx = 0;
      constraints.gridy = ++currentGridY;
      constraints.anchor = GridBagConstraints.EAST;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      contentPanel.add(javaHomePathLabel, constraints);
    }
    javaHomePathLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    javaHomePathLabel.setText("Java installation");

    javaHomePathTextField = new JTextField();
    javaHomePathButton = new JButton();
    {
      GridBagConstraints constraints = new GridBagConstraints();
      constraints.gridx = 1;
      constraints.gridy = currentGridY;
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      JPanel panel = new JPanel();
      panel.setLayout(new BorderLayout());
      panel.add(javaHomePathTextField, BorderLayout.CENTER);
      panel.add(javaHomePathButton, BorderLayout.EAST);
      contentPanel.add(panel, constraints);
    }
    javaHomePathTextField.setHorizontalAlignment(JTextField.LEFT);
    javaHomePathTextField.addCaretListener(javaHomePathCaretListener);

    javaHomePathButton.setText("Browse...");
    javaHomePathButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        FileDialog dialog = new FileDialog(PreferencesView.this, "Select Java Folder", FileDialog.LOAD);
        System.setProperty("apple.awt.fileDialogForDirectories", "true");
        dialog.setVisible(true);
        System.setProperty("apple.awt.fileDialogForDirectories", "false");
        if (dialog.getDirectory() != null) {
          javaHomePathTextField.setText(dialog.getDirectory() + dialog.getFile());
        }
      }
    });

    javaHomePathExplanationLabel = new JLabel();
    {
      GridBagConstraints constraints = new GridBagConstraints();
      constraints.gridx = 1;
      constraints.gridy = ++currentGridY;
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.insets.left = 5;
      constraints.insets.bottom = 5;
      contentPanel.add(javaHomePathExplanationLabel, constraints);
    }
    javaHomePathExplanationLabel.setFont(new Font("Lucida Grande", 0, 11));
    javaHomePathExplanationLabel.setText("The path to the Java installation home folder");

    // log path
    logPathLabel = new JLabel();
    {
      GridBagConstraints constraints = new GridBagConstraints();
      constraints.gridx = 0;
      constraints.gridy = ++currentGridY;
      constraints.anchor = GridBagConstraints.EAST;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      contentPanel.add(logPathLabel, constraints);
    }
    logPathLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    logPathLabel.setText("Log folder");

    logPathTextField = new JTextField();
    logPathButton = new JButton();
    {
      GridBagConstraints constraints = new GridBagConstraints();
      constraints.gridx = 1;
      constraints.gridy = currentGridY;
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      JPanel panel = new JPanel();
      panel.setLayout(new BorderLayout());
      panel.add(logPathTextField, BorderLayout.CENTER);
      panel.add(logPathButton, BorderLayout.EAST);
      contentPanel.add(panel, constraints);
    }
    logPathTextField.setHorizontalAlignment(JTextField.LEFT);
    logPathTextField.addCaretListener(logPathCaretListener);

    logPathButton.setText("Browse...");
    logPathButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        FileDialog dialog = new FileDialog(PreferencesView.this, "Select Log Folder", FileDialog.LOAD);
        System.setProperty("apple.awt.fileDialogForDirectories", "true");
        dialog.setVisible(true);
        System.setProperty("apple.awt.fileDialogForDirectories", "false");
        if (dialog.getDirectory() != null) {
          logPathTextField.setText(dialog.getDirectory() + dialog.getFile());
        }
      }
    });

    logPathExplanationLabel = new JLabel();
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

    protected FileDialog chooser;
   
    public TokenizerPluginsPanel(Yoshikoder yk){
        super(new BorderLayout());
        yoshikoder = yk;
        chooser = new FileDialog(yoshikoder, Messages.getString("open"), FileDialog.LOAD);
        chooser.setFilenameFilter(DialogUtil.jarFilenameFilter);
               
        makeGUI();
    }
View Full Code Here

    return str;
  }
 
    public static FileDialog makeFileDialog(Frame parent, String name, int type, FilenameFilter filter){
        if (filter == null)
            return new FileDialog(parent, name, type);
       
        FileDialog dia =  new FileDialog(parent, name, type);
        dia.setFilenameFilter(filter);
        return dia;
    }
View Full Code Here

        public OpenAction() {
        }
        public void actionPerformed(ActionEvent e) {
            File f = null;
            if (Platform.isOSX) {
                FileDialog fileDialog =
                    new FileDialog(JSVGViewerFrame.this,
                                   Resources.getString(OPEN_TITLE));
                fileDialog.setFilenameFilter(new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                        Iterator iter = getHandlers().iterator();
                        while (iter.hasNext()) {
                            SquiggleInputHandler handler
                                = (SquiggleInputHandler)iter.next();
                            if (handler.accept(new File(dir, name))) {
                                return true;
                            }
                        }
                        return false;
                    }
                });
                fileDialog.setVisible(true);
                String filename = fileDialog.getFile();
                if (fileDialog != null) {
                    String dirname = fileDialog.getDirectory();
                    f = new File(dirname, filename);
                }
            } else {
                JFileChooser fileChooser = null;
View Full Code Here

        userStylesheetBrowse = new JButton(Resources.getString(PREFERENCE_KEY_LABEL_BROWSE));
        userStylesheetBrowse.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                File f = null;
                if (Platform.isOSX) {
                    FileDialog fileDialog =
                        new FileDialog
                            ((Frame) getOwner(),
                             Resources.getString(PREFERENCE_KEY_BROWSE_TITLE));
                    fileDialog.setVisible(true);
                    String filename = fileDialog.getFile();
                    if (filename != null) {
                        String dirname = fileDialog.getDirectory();
                        f = new File(dirname, filename);
                    }
                } else {
                    JFileChooser fileChooser = new JFileChooser(new File("."));
                    fileChooser.setDialogTitle
View Full Code Here

  //public boolean jk = true, jl = true;
 
  public Game()
  {
    Frame F = new Frame()
      FileDialog FD = new FileDialog(F,"Terkep betoltes",FileDialog.LOAD)//map betoltese
      FD.show();             
      String mapfile = FD.getFile();      //map neve
      String utvonal = FD.getDirectory();    //map eleresi utvonala
     
      if (mapfile == null) System.exit(0);
   
      File map = new File(utvonal+mapfile);
   
View Full Code Here

  }

  // shows the load file directory dialog
  private String loadFile(Frame f, String title, String fileType) {
    String fn = getCurrentFilename();
    FileDialog fd = new FileDialog(f, title, FileDialog.LOAD);
    fd.setFile(fileType);
    String path = fn.replaceAll(new File(fn).getName(), ""); // set the default dir to the path of the current file
    fd.setDirectory(path);
    fd.setLocation(50, 50);
    fd.setVisible(true);
    return fd.getDirectory() + fd.getFile();
  }
View Full Code Here

            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

     * the file objct.  If any errors occur, return null and
     * do not modify dest.
     */
    public static File userLoadMText(String title, MText dest, Frame owner) {

        FileDialog dialog = new FileDialog(owner, title, FileDialog.LOAD);
        dialog.show();
        String fileStr = dialog.getFile();
        String dirStr = dialog.getDirectory();

        if (fileStr != null) {
            File rval = new File(dirStr, fileStr);
            MConstText src = loadMText(rval);
            if (src != 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.