Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Wiki
Search Coderanch
Advance search
Google search
Register / Login
Bookmark Topic
Watch Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Wiki
Code Barn Hello Server File
posted 6 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.applet.Applet; import java.awt.FlowLayout; import java.awt.Label; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class HelloServerFile extends Applet { public void init() { // everything happens in init setLayout( new FlowLayout( FlowLayout.CENTER, 1000, 5 ) ); String line = null; try { // create a URL (the URL for the text file on the server) then open a stream URL textURL = new URL( getCodeBase() , "test.txt" ); BufferedReader reader = new BufferedReader( new InputStreamReader( textURL.openStream() ) ); // now read the lines one at a time while ( ( line = reader.readLine() ) != null ) { add( new Label( line ) ); } // close while loop reader.close(); } // close try catch ( Exception e ) { e.printStackTrace(); } } // close init } // close applet
CodeBarnApplets
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Getting Applet to communicate with the Web server
File access
Code Barn Load A Gif
Code Barn Hello Thread
Code Barn Hello Thread Two
More...