package displayables;
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.lcdui.TextBox;
public class VisorDeTexto extends TextBox {
public VisorDeTexto(String title) {
super(title, title,256,0);
this.setString(this.readHelpText(title));
}
private String readHelpText(String filename)
{
try
{
FileConnection fc = (FileConnection) Connector.open( filename, Connector.READ);
InputStream is = fc.openDataInputStream();
StringBuffer sb = new StringBuffer();
int chr;
// Read until the end of the stream
while ((chr = is.read()) != -1)
sb.append((char) chr);
return sb.toString();
}
catch (Exception e)
{
System.out.println("Unable to create stream");
}
return null;
}
}