Java JFrame findFileOpen(JFrame frame, String ext, String desc)

Here you can find the source of findFileOpen(JFrame frame, String ext, String desc)

Description

find File Open

License

Open Source License

Declaration

public static File findFileOpen(JFrame frame, String ext, String desc) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;

public class Main {
    public static File findFileOpen(JFrame frame, String ext, String desc) {
        JFileChooser chooser = new JFileChooser();
        chooser.setFileFilter(new FileNameExtensionFilter(desc, ext));

        if (chooser.showOpenDialog(frame) != JFileChooser.APPROVE_OPTION) {
            return null;
        }/*from   ww w  . j a v a2s  .  c  o  m*/

        return chooser.getSelectedFile();
    }
}

Related

  1. enable(final JFrame frame)
  2. enterFullScreenIfPossible(JFrame mainAppFrame)
  3. error(JFrame frame, String msg)
  4. exitFullScreen(JFrame mainAppFrame)
  5. fileChooser(JFrame frame, boolean saveDialog, String windowName, String filterName, String filterExtension)
  6. findFileSave(JFrame frame, String ext, String desc)
  7. findJFrame(Component c)
  8. findJFrame(Component myComponent)
  9. fitToDesktop(final JFrame frame)