package readwebfile; import java.awt *;. import java.awt.event *;. import java.applet *;. import java.net *;. import java.io. *; public class ReadWebFileApplet extends Applet {TextField textField1 = new TextField (); Button button1 = new Button (); TextArea textArea1 = new TextArea (); public ReadWebFileApplet () {try {jbInit ();} catch (Exception e) {e.printStackTrace ();}} private void jbInit ( Throws exception {textfield1.settext ("Enter Network Address and File Name"); TextField1.setBounds (New Rectangle (0, 1, 179, 30)); this.setLayout (NULL); Button1.setLabel ("Get Network File") ; button1.setBounds (new Rectangle (186,4,108,28)); button1.addActionListener (new java.awt.event.ActionListener () {public void actionPerformed (ActionEvent e) {button1_actionPerformed (e);}}); textArea1. setBounds (new Rectangle (1,37,294,261)); this.add (textField1, null); this.add (textArea1, null); this.add (button1, null);} public void readURL (String uRLName) throws Exception {int Httpresult; URL URL = New URL (URLNAME); urlConnection urlconn = url.openconnection (); URLCON n.connect (); HttpURLConnection httpconn = (HttpURLConnection) urlconn; HttpResult = httpconn.getResponseCode (); if (! HttpResult = HttpURLConnection.HTTP_OK) textArea1.setText ( "Could not connect to the" textField1.getText ()); else { int filesize = urlconn.getContentLength (); InputStreamReader isReader = new InputStreamReader (urlconn.getInputStream ()); char [] buffer = new char [2048]; int num = 0; while (num> -1) {num = isReader. Read (Buffer); if (Num <0) Break; Textarea1.Append (New String (Buffer, 0, Num));} isreader.close ();}} void button1_actionperformed (ActionEvent E) {string string str = E.GetActionCommand (); try {textarea1.setText (""); readURL (TextField1.getText ());