import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.colorchooser.*;
public class FileChooserDemo extends JFrame {
public FileChooserDemo() {
super("FileChooserDemo");
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Choose a file");
this.getContentPane().add(fileChooser);
fileChooser.show();
}
public static void main(String[] args) {
JFrame frame = new FileChooserDemo();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
});
frame.pack();
frame.setVisible(true);
}
}
|