MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import javax.swing.JFileChooser;
import javax.swing.JFrame;

public class MainClass extends JFrame {
    public MainClass() {
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setDialogTitle("Choose a file");
        this.getContentPane().add(fileChooser);
        fileChooser.setVisible(true);
    }

    public static void main(String[] args) {
        JFrame frame = new MainClass();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.pack();
        frame.setVisible(true);
    }
}