Friday, 27 February 2015

How TO Create Open File Chooser In Java

This tutorial shows how to create simple File Chooser in java.It has two types 

  1. Open File Chooser.
  2. Save File Chooser.
For save file chooser see How To Create Save File Chooser In Java.

    CODING:

    import javax.swing.*;
    import java.awt.*;
    class myjframe1 extends JFrame
     {

    public myjframe1()
     {

    setTitle("Open FileChooser");
    setSize(300, 200);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);        
    JFileChooser open = new JFileChooser();
    int option = open.showOpenDialog(this);

    }
    }

    class simpframe
    {
    public static void main(String args[])
    {
    myjframe1 x= new myjframe1();
    }
    }

    OUTPUT:






    No comments:

    Post a Comment