import java.applet.*; import java.awt.*; import java.io.*; import java.util.Scanner; public class fileapplet extends Applet { public void paint(Graphics g) { BufferedReader diskInput; String word; int a=0,b=0; try { //reads in words from a file diskInput = new BufferedReader(new InputStreamReader(new FileInputStream("Tree.txt"))); // file name is on command line Scanner input=new Scanner(diskInput); while (input.hasNext()) { word=input.next(); word=word.toLowerCase(); // use lower case only g.drawString(word,a,b); a+=10; b+=10; } } catch (IOException e) { } } }
<html> <applet code="fileapplet.class" width="100" height="100"> </applet> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)