Solved

getAppletContext error

Posted on 1997-05-08
6
283 Views
Last Modified: 2006-11-17
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);
                  }

              }
0
Comment
Question by:boksi1
  • 4
  • 2
6 Comments
 

Author Comment

by:boksi1
ID: 1220243
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
0
 

Author Comment

by:boksi1
ID: 1220244
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
0
 
LVL 1

Accepted Solution

by:
mlimotte earned 10 total points
ID: 1220245
I answered the compiler error problem as a comment under the original question.

As to your second question, about the HTML tag; you didn't show the HTML that you are trying to use, but here's a sample:

<HTML>
<BODY>
<APPLET CODE="package.class_name.class"
        WIDTH=300
        HEIGHT=200>
</APPLET>
</BODY>
</HTML>

The code name should end in ".class", width and height are mandatory. There are other options that you can use in the APPLET tag which are listed in the documentation.  And you can add paramaters between the <APPLET> and </APPLET> tags.

If you have specfic questions about how to use the <APPLET> tag you can add additional comments.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:boksi1
ID: 1220246
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.
0
 
LVL 1

Expert Comment

by:mlimotte
ID: 1220247
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.
0
 

Author Comment

by:boksi1
ID: 1220248
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!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Saving Tweets with emojis using Twitter4J in a Mysql table 2 73
Java and GPO 11 66
javap not working 8 36
java jdbc batch example 8 17
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now