Created
March 4, 2011 14:25
-
-
Save maheshmc2/854677 to your computer and use it in GitHub Desktop.
Sample JFileChooser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import javax.swing.JFileChooser; | |
import javax.swing.JPanel; | |
public class TestFileChooser extends JPanel { | |
public static void main(String... args){ | |
TestFileChooser tf = new TestFileChooser(); | |
tf.showMe(); | |
// jf.showOpenDialog(TestFileChooser.this); | |
} | |
public void showMe(){ | |
JFileChooser jf = new JFileChooser(); | |
jf.showOpenDialog(TestFileChooser.this); | |
File f = jf.getSelectedFile(); | |
System.out.println("File Choosen is: "+f.getName()); | |
System.out.println("File Choosen is: "+f.getAbsolutePath()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment