Thursday, February 15, 2007

Tourcher Movies Japanase



This example explains how to open a text file in java, showing it in through a JTextArea
name "Text" and choosing the file with a JFileChooser
.

String Text = ""; fc.showOpenDialog (this);
fc.getSelectedFile File Open = (); / Returns the File we will leerName
if (Abrir! = null) {FileReader
 Texto.setText (""); File = new FileReader (Open); 
BufferedReader read = new BufferedReader (file);
while ((Text = read. readLine ())!= null) {
Texto.append (Text + "\\ n") / / append concatenates the line read}

leer.close ();}


} catch (IOException ioe) {
System . out.println (ioe);}





0 comments:

Post a Comment