CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2011
    Location
    Finland
    Posts
    12

    Question Applet dealing with text data

    Hi,
    I am new to java programming.
    I am assigned to write an applet simulator/originally in matlab code but now its needed to be in java applet for web interactivity/ , which draws graphics on a JPanel, based on the a 102X102 matrix data (many *.txt files) stored in the same server. The data is so huge(about 76MB) that the applet can't load it once and the applet should interact back and forth based on user selections.

    In short,
    * multiple text files(102X102 decimal #matrices) in the same server as the applet,
    *applet having GUI for user input and flexible selection, which file analyse and plot,

    Does applets have this characterstics? How can I start this, few lines of ideas and resources please.

    Very much thanks in advance.

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Applet dealing with text data

    An Applet would be able to read files from the server is was loaded from.
    The GUI used by an Applet is the same as that used by any other Java program.

    Google could get you examples. Also go to the various Java forums and search there for Applet code.
    Norm

  3. #3
    Join Date
    May 2011
    Location
    Finland
    Posts
    12

    Re: Applet dealing with text data

    Thanks for your swift reply,
    I have another question,
    I am now reading and writing files, to/from disk to an applet program. But if, I deploy the applet on a web server, is it possible that my program may fail to locate the file on the server? Since the applet is running from a client browser. What modifications, should I do to handle it?
    I am a bit confused with lots of file handling classes, I appreciate a website having concise tutorial at least to start.

    Cheers!

  4. #4
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Applet dealing with text data

    To get files from the server, the applet must do an HTTP Get. There are several classes in Java that you can use to do that. For example look at: HttpURLConnection and URLConnection

    Unsigned Applets from servers do NOT do any local file I/O.

    To write files on the server, you'll need code on the server to receive the file from the applet and write it locally on the server.
    Norm

  5. #5
    Join Date
    May 2011
    Location
    Finland
    Posts
    12

    Re: Applet dealing with text data

    This forum is so active and awesome one, I am amazed by your immediate and precise help, mommy next door(?)! Probably my last query will be about the idea of signing,

    Unsigned Applets from servers do NOT do any local file I/O.

    To write files on the server, you'll need code on the server to receive the file from the applet and write it locally on the server.
    The whole of concept of my project is to read text files(a thousand of them), each of them containing 102X102 matrix, measured values. When a user inputs a typical value, say electric field value limit, then the applet has to read within each file and search a value greater than or equal to that limit. Then the applet must enlist the files surpassing that limit, in Combo box. When the same user selects a specific file from the combo, the applet should read another map(in *.jpg) and draw a color intensity over the map figure, based on that 102X102 measured values on a file in the remote server.

    Is there a need for signing applets, in this scenario? I also need the whole process to be finished in the server, the client browser receives outputs only. should I do a special thing to do this? Is applet as a whole a server side process by default?

  6. #6
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Applet dealing with text data

    Applets can get files from an HTTP server by issuing a HTTP Get as I mentioned above.
    Only signed applets can read from the local disk. By Local I mean the computer the browser with the HTML page with the Applet.
    If you are having the applet get files from its server, the applet does not need to be signed.
    Is applet as a whole a server side process by default?
    The applet runs in the client's browser.

    If there is a lot of file reading to do and then to generate a report from that data to display to the user, then you want to have code on the server to do that work and to send only the report to the applet to display.
    Norm

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured