Here you can find the source of open(JFrame view)
Parameter | Description |
---|---|
view | parent view. |
public static File open(JFrame view)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.io.File; public class Main { private static JFileChooser chooser = new JFileChooser(); private static File file; /**/* www.j ava2 s . co m*/ * Creates "Open file" dialog. * * @param view parent view. * @return chosen file. */ public static File open(JFrame view) { int fileChosen = chooser.showDialog(view, "Open file"); if (fileChosen == JFileChooser.APPROVE_OPTION) { chooser.requestFocus(); file = chooser.getSelectedFile(); } return file; } }