aspose file tools*
The moose likes Applets and the fly likes applets reading from text file on client machine? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "applets reading from text file on client machine?" Watch "applets reading from text file on client machine?" New topic
Author

applets reading from text file on client machine?

Charlie Flynn
Greenhorn

Joined: Jul 11, 2001
Posts: 8
Hello,
Is it possible to get an applet to read a text file on a client machine?

A background process on the client's desktop is generating numbers and writing these to a text file. I want an applet to display different colours based on these numbers. This text file will be updated on a per second basis and the applet must respond in real time to these updates. For purposes of demonstration, I am the user. Do I need to grant the applet any extra privileges to read from the text file and how do I do this as the applet programmer?
o If it is not possible to read from a text file, is there any other way I can send the applet these numbers, for example as parameters to some function?

Alternative 1:
I want to have access to mouse co-ordinates both within and outside of the applet. I have been using the mouseDragged method. Once a drag is performed inside the applet the applet can continue to read co-ordinates of the motion outside the canvas frame provided the mouse button remains depressed. I want to be able to do this without enforcing drag. Is it possible to write a method that
Mouse motion within the browser affects a small coloured window that is a second applet. The applet receiving the co-ordinates from the mouse motion will appear as a second window within the browser changing colour based on these co-ordinates. My aim is to have the applet registering motions should have as little graphic impact on the html page as possible, in other words, the users should be unaware of its presence.
Alternative 2:
Is it possible to create a transparent applet that can sit over the html page so that all mouse movements are contained within the applet canvas - but the applet has no graphic impact on the page?
Alternative 3:
If it is not possible to read from the file on a client machine, can I get the client to send a text file to the server and get the server to process the numbers and sent them back to the client for display in an applet on the client machine?
==================================================================================================
For the same coloured screen I need to write a second similar program that changes colour based on network traffic or cpu load instead of mouse motion. What java API would I need to use for this? Or what is the best way to begin to approach this? P.S. I am using windows 98 for my clients and server.
Many Thanks,
Charlie Flynn.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15628
    
  15

No, an unsigned browser-based applet can't open local files. Otherwise when you visited www.evilserver.com, it could serve you an applet that sent it your file with all those saved passwords in it
Your graphical needs are a bit large for me to understand without careful reading, but using the drag and drop api is way too much overhead for simple mouse tracking - just use the mouse tracker.
As far as graphing network/cpu usage, the APIs you'd call to get that info are different for each OS, so you'd need to call a JNI component that invoked the underlying OS API (if one existed).


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: applets reading from text file on client machine?
 
Similar Threads
communicating applets
mousedrag + mousemove
drawing with the mouse and zooming
Alternate mouse control
zooming an image / imageicon