Please Be Kind Please
I'm using eclipse to run the following and nothing happens;
import java.io.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.filechooser.*;
public class FileSelector {
private String fileName;
public String getFileName(){
JFileChooser fc;
File TSTTBill;
fc = new JFileChooser("Select the TSTT Bill File to upload");
int returnVal = fc.showOpenDialog(null);
TSTTBill = fc.getSelectedFile();
fileName = TSTTBill.getAbsolutePath();
System.out.println(fileName);
return fileName;
}
public void main(String[] args) {
String tsttFileName;
tsttFileName = getFileName();
}
}
[714 byte] By [
mransomea] at [2007-11-27 10:07:54]

> First thing is that make your main maethod static so
> that you can use it without any object.
Making it static still won't allow the program to run as the OP is trying to access non-static variables and create non-static objects...
I'd suggest the OP looks at the basic Swing Tutorials before trying to use a JFileChooser
http://java.sun.com/docs/books/tutorial/uiswing/
> > First thing is that make your main maethod static
> so
> > that you can use it without any object.
>
> Making it static still won't allow the program to run
> as the OP is trying to access non-static variables
> and create non-static objects...
>
> I'd suggest the OP looks at the basic Swing Tutorials
> before trying to use a JFileChooser
>
> http://java.sun.com/docs/books/tutorial/uiswing/
I'd suggest he doesn't even bother with Swing at all until he can get "Hello, World" working. I'd suggest he throws Eclipse away, too