File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Question for an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Question for an applet" Watch "Question for an applet" New topic

Question for an applet

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
I want to know following:
(1) Can Client open file on the server and display the text line by line in TextBox and label?
(2) Can Developer embed an applet anywhere in HTML i mean in frame, forms, Tables?
(3) Can Client open following files from the server and display it in the browser. If yes, how?:
Bitmaps, HTML or Text File or Java class or any other type like audio clip,video clip(with AWT classes).
(4) How bitmaps or text file or applets communicate with the browser?
Thanks in advance,
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Here are the answer to your questions :
(1) Yes... you would do something like the following :

Then just read from the InputStream like it is a normal file handle and assign it to your TextBoxes or Labels.
(2) Yes, I believe the applet tag can exist anywhere in an HTML document...
(3) Kinda... you would do something like this :

However, this has to be a filetype that the browser understands, which leads into the second part of the question...
Bitmaps - Most browsers can understand graphics in GIF and JPG formats... and perhaps some others depending on the browser. IE would definately be able to display a BMP, though I am not certain about other browsers...
HTML - obviously...
Java Class - Basically you would just load a HTML page with the class you want to load specified in the pages applet tag...
Audio CLip, Video Clip - This depends on the browser... if the browser understands the format it will display... if not you may get garbage on the screen or have to download a plugin...
I'm not sure I understand what you mean by appending (with AWT classes) onto this section... If you mean can you open these filetypes inside your applet insteand of in your browser... Well some of the preceding answers would be different... i.e. Java only supports GIF, JPG, and (as of 1.3) PNG graphic formats, no problem displaying HTML or text files, if you want to dynamically load a Java class you will have to look into distributed technologies like RMI or CORBA, and I believe that something called the Java Media Framework (JMF) will play some formats of video and audio files...
(4) Basically the browser knows what files are what types. So it just downloads them from the server and displays them in the appropriate manner. The only exception is the applet... It is recognized by a special HTML tag and then is downloaded and executed in a special "panel" within the HTML document.
Anyways, hope this helps,

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
I really appreciate your response.Thank a lot Nathan Pruett.
Take care
I agree. Here's the link:
subject: Question for an applet
It's not a secret anymore!