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);
}
}
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