Link to home
Start Free TrialLog in
Avatar of boksi1
boksi1

asked on

getAppletContext error

Continuing with the applet which loooks like it can do everything I need it to- How do I resolve the getAppletContext compile error - please refer to my question
regarding user input to form a url to read a file from a server. Many thanks and Kudos to Mlimotte - you are indeed a Java expert and a fine teacher! Here's the code:
import java.awt.*;
              import java.net.*;
              import java.io.*;

              public class getFile01 extends java.applet.Applet {
                 
                  TextArea text = new TextArea();
                  Button btnOk = new Button("Ok");
                  String server = "abcdefg",
                  url_prefix = "/hijkl/m_",
                  url_suffix = ".txt";


                  public void init() {
                  setLayout(new BorderLayout());
                  add("Center",text);
                  add("South", btnOk);
                  }
                 
                  public boolean action(Event event, Object what)
              {
                  if (event.target == btnOk)
                  {
                 
                  try {
                  URL url = new URL ("http", server,
                  url_prefix + text.getText() + url_suffix);
                  getAppletContext.showDocument(url);
                  }
                  catch (Exception exp) {
                  text.setText("Cannot Load");
                  }
                 
                  return true;
                  }
                  else
                  return super.action(event, what);
                  }

              }
Avatar of boksi1
boksi1

ASKER

If you can respond to this can you please cc me at my work email address    usmtgddt@ibmmail.com as well as caesar@netins.net
thank you, Joseph Ruisi
Avatar of boksi1

ASKER

I forgot to ask but would like to be sure that I am using the assoviated HTML applet tag correctly - can you please comment on this. Thanks, Joseph Ruisi
ASKER CERTIFIED SOLUTION
Avatar of mlimotte
mlimotte

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of boksi1

ASKER

Thanks for the response- I am unclear on how the comment to the original question resolves the compiler error. I am confused
because I thought the comment regarded the two applet approach.
Can you please clarify for me how to resolve the
error. I apologize for my ignorance. What exactly do I do to remove the error in the original single applet approach?
I understand getAppletContext(); to be a method. Somehow I am
stumbling.
I've added an additional comment under the original question to clarify what you need to do.  If you'd like to respond, please do it there so we can keep the question threads distinct.
Avatar of boksi1

ASKER

Yes - In case you haven't looked at my comment on the original
question - getFile compiled successfully and I wil be testing it.
Mlimotte-THANK YOU!!!