Writing Applets
Lesson: Practical Considerations when Writing Applets
A Simple Network Client Applet The Writing a Datagram Client and ServertutorialIcon (in the Writing Applets trail) section of the Custom Networking and Security trail contains example code for two applications, a client and a server. This section rewrites the client to be an applet. Here's the applet source codesourceIcon (in a .java source file). (Here's the corresponding 1.0 source codesourceIcon (in a .java source file).) The client has been changed not only to communicate with the host the applet came from, but also to have a graphical UI, and to have a loop so that it can get as many quotes as you like. You can run the applet by including it in a page with the following HTML code: <APPLET CODE=QuoteClientApplet.class =500 =100 </APPLET

Here's a link to a example-1dot1/quoteApplet>page that contains the above HTML code. By saving this page to a file on your local HTTP server, you can use it to communicate with the server-side application that will be running on the HTTP server. You must also save the compiled form of the applet to the same directory.

Before the applet can get quotes, you need to run the server on the host that the applet came from. You then need to note the number of the port that the server is listening on. After you enter this port number into the applet, it will hook up with the server and you'll be able to get one-line quotations. Below are detailed instructions, followed by pictures of the server and the applet in action.

  1. Compile QuoteServer.javasourceIcon (in a .java source file) and QuoteServerThread.javasourceIcon (in a .java source file). Here's a text file (example-1dot1/one-liners.txt>one-liners.txt) that should be in the same directory as the resulting class files.
  2. On the computer that serves the applet class file (through HTTP), invoke the interpreter on the QuoteServer class. For example, if you view the applet's page with the URL http://mymachine/quoteApplet, then you need to run the server on the host named mymachine.
  3. Record the port number that the quote server displays.
  4. Enter this number into the applet's text field.
  5. Press the Send button to request a quote from the server. You should see a quote appear in the text area.

 

Bhopal news
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

freelance web designer india ecommerce web developer | Ecommerce web design, software developer india | Web hosting India Windows hosting | India web hosting Windows hosting India | India software developer | web designer india