public class filechosser extends JFrame {
private JButton jButton = null;
public filechosser() {
super("FileChosserDemo");
initialize();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setSize(400, 300);
}
/**
* This method initializes this
*
*/
private void initialize() {
this.setSize(new Dimension(303, 226));
this.setContentPane(getJButton());
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
String filename = "c:" + File.separator;
JFileChooser fileChooser = new JFileChooser(new File(filename)); ;
}
});
}
return jButton;
}
/**
* @param args
*/
public static void main(String[] args) {
new filechosser().setVisible(true);
}
}