Click to See Complete Forum and Search --> : reading?


The One
03-03-2006, 01:49 PM
i created the following code to read a textfile. But i dont know how after reading that textfile to paste wats in it into a textfield in a gui. How do i do it?


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

public class read {
public static void main (String[] args) throws IOException{
FileReader fr = new FileReader("Salary.txt");
BufferedReader br = new BufferedReader(fr);
String userName = br.readLine();
while (userName != null) {
System.out.println(userName);
userName = br.readLine();
}
br.close();
fr.close();

}
}