Scanner
i am having a textarea while i click open, filchooser will choose file and then it open it to that particular textarea...
the problem is when i used to open a large file(*.txt) using the below code ..it will display only some last lines...(ignore almost everything)
is there any way to view fuil txt file as i saved...
class OpenListenerimplements ActionListener
{
publicvoid actionPerformed(ActionEvent evt)
{
JFileChooser openchooser =new JFileChooser();
openchooser.setDialogTitle("Open a file...");
int state = openchooser.showOpenDialog(null);
File file = openchooser.getSelectedFile();
if(file !=null && state == JFileChooser.APPROVE_OPTION)
{
Scanner scan =null;
try
{
scan =new Scanner(new BufferedReader(new FileReader(file)));
scan.useDelimiter(",\\s*");
while (scan.hasNext())
{
textarea.setText(scan.next());
}
}
catch(Exception e){e.printStackTrace();}
finally
{
if (scan !=null)
{
scan.close();
}
}
}
elseif(state == JFileChooser.CANCEL_OPTION)
{
return;
}
}
}

