Help me to resovle this problem

Dear friend:Could you help me to this problem.I want to create a class.It can scan the specific directory to get the list of files in it.
[158 byte] By [realwxd] at [2007-9-26 2:20:12]
# 1

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class SwingTrial1 extends JFrame {

boolean inAnApplet = false;

public SwingTrial1 () {

Container contentpane = getContentPane();

contentpane.add(new JFileChooser("Button 1 (North)"),BorderLayout.NORTH);

addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {

System.exit(0);

}

});

}

public static void main(String[] args) {

SwingTrial st = new SwingTrial();

st.setTitle("SwingTrial");

st.pack();

st.setVisible(true);

}

}

GLJdotcom at 2007-6-29 9:23:40 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
Thank you very much!
realwxd at 2007-6-29 9:23:40 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3

On the line listed:

contentpane.add(new JFileChooser("Button 1 (North)"),BorderLayout.NORTH);

Replace it with an empty contructor as follows:

contentpane.add(new JFileChooser());

I did a quick cut and paste from another program and changed a JButton to the JFileChooser and forgot to clear the parameters.

Lance

GLJdotcom at 2007-6-29 9:23:40 > top of Java-index,Archived Forums,New To Java Technology Archive...