Does anyone there know how to open a text file and append its texts in a text area? I used the ff code to do that but the texts are in one straight line.
This is my code:
code:
----------------------------------------------------------------------------
public void actionPerformed(ActionEvent ae){
JMenuItem source = (JMenuItem)(ae.getSource());
if(source.getText().equalsIgnoreCase("open")){
try{
FileInputStream fi=new FileInputStream(openfile());
BufferedReader br=new BufferedReader(new InputStreamReader(fi));
String s01=br.readLine();
if(s01 != null) textArea.setText(s01);
br.close();
fi.close();
}
catch(Exception ex){}
}
}
public String openfile(){
FileDialog fd=new FileDialog(new Frame(),"File Select");
fd.show();
String fullpath=fd.getDirectory()+fd.getFile();
fd.dispose();
return fullpath;
}
----------------------------------------------------------------------------
Or do you know what I should add in my code to get the design of the text file?
Thanks!