ok this is part of my code right now, and i have an issue.
this reads the entire file, how do i get it to go line by line
public void init (){
if (fInBrowser) {
// Get setup parameters from
applet html
String param = getParameter ("FileToRead");
if (param != null) {
fFileToRead = new String (param);
}
}
}//Init
/** Use a URL object to read the file **/
public void readFile () {
String line;
URL url=null;
// Get the URL for the file.
try {
if (fInBrowser)
url = new URL (getCodeBase (), fFileToRead );
else {
File file = new File (fFileToRead);
if (file.exists () )
url = file.toURL ();
else {
fTextArea.append ("No file found");
System.out.println ("No file found");
System.exit (0);
}
}
}
catch (MalformedURLException e) {
fTextArea.append ("Malformed URL = "+e);
System.out.println ("Malformed URL= "+e);
return;
}
// Open a stream to the file using the URL.
try {
InputStream in = url.openStream ();
BufferedReader dis =
new BufferedReader (new InputStreamReader (in));
fBuf = new StringBuffer () ;
while ( (line = dis.readLine ()) != null) {
fBuf.append (line + "\n");
}
in.close ();
}
catch (IOException e) {
fTextArea.append ("IO Exception = "+e);
System.out.println ("IO Exception = "+e);
return;
}
} // readFile
/**
* Can use the start () method, which is called after
* init () and the display has been created.
**/
public void start (){
string temp[] = new String[6];
// Now read the file.
readFile ();
for (int x= 0; x < 40; x ++){
tiles[x].setText(fBuf.toString ());
}
}