|
|
||||
|
||||
|
|
||||
|
||||
|
|
|
|
||||
|
||||
|
|
||||
|
||||
|
|
Code Barn Hello Server File | |
Explanation of HelloServerFile applet Number of files: 2 (HelloServerFile.class, and a text file named test.txt) What it does: Gets the text from a text file on the server and displays each line from the text file on the screen. Applets can't actually *read* from the server, but the URL class allows an applet to GET text from a URL. To GET text from a URL:
HelloServerFile does a very simple readLine on a JavaDoc:java.lang.BufferedReader .
To display the text from the text file, HelloServerFile creates a unique Label object to display each line of text. This is just for an example of a way to dynamically generate components based on information in a text file. At compile-time, there was no way to know how many Labels would be needed.
Code
CodeBarnApplets | |