Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.io.*;
- public class FileChooserExample {
- public static void main(String[] args) {
- JFrame frame = new JFrame("File Chooser Example");
- JFileChooser chooser = new JFileChooser();
- int result = chooser.showOpenDialog(frame);
- if (result == JFileChooser.APPROVE_OPTION) {
- File file = chooser.getSelectedFile();
- System.out.println("Selected file: " + file.getAbsolutePath());
- }
- }
- }
Advertisement
Advertisement