Hi,
I really need help. I am trying to display the contents of a text file by having an openFile() method.
Here is my code so far:
private void openFile()
{
JFileChooser chooser = new JFileChooser();
int result = chooser.showOpenDialog(this);
if(result == JFileChooser.CANCEL_OPTION)
return;
//obtain selected file
File fileName = chooser.getSelectedFile();
try
{
//Buffered Reader
BufferedReader reader = new BufferedReader(new FileReader(fileName));
String empData = reader.readLine();
}
catch(IOException ioException)
{
JOptionPane.showMessageDialog(this, "FILE ERROR", "FILE ERROR", JOptionPane.ERROR_MESSAGE);
}
}
This is just a small portion of the code from a much larger problem. If anyone can help me sort this out I am willing to send the whole file.
Thanks
[ December 04, 2004: Message edited by: Zahra Vir ]