Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;

public class Main {
    public static void main(String[] args) {
        FileNameExtensionFilter extFilter = new FileNameExtensionFilter("Java Source  File", "java", "jav");
        // Set the file filter
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.addChoosableFileFilter(extFilter);

        int returnValue = fileChooser.showDialog(null, "Attach");
        if (returnValue == JFileChooser.APPROVE_OPTION) {
            // Process the file
        }

    }
}