Articles in the Java Codes Category
Java Codes »
The html code below shows how an applet parameter would be specified in an HTML file.
<applet code=AppletClassName width=120 height=120>
<param name=parameter1 value=”value1″>
<param name=parameter2 value=”value2″>
</applet>
Here’s how the value of an applet parameter can be retrieved:
String value = applet.getParameter(“parameter1″);
Java Codes »
No. Java applets may be served by any HTTP server. On the server side they are handled the same as any other file, such as a text, image, or sound file. All the special action happens when the applet class files are interpreted on the client side by a Java technology enabled browser, such as HotJava browser or 1.x or Netscape 3.x/4.x.
Java Codes »
You can determine the host from where an Applet is loaded using getCodeBase() method.
An example usage is implementing a simple copy protection scheme. If the retrieved codebase does not equal to your predefined host then you can quit.
import java.applet.*;
public class MyApplet extends Applet {
public void init() {
System.out.println(getCodeBase());
//
// you can check the value of getCodeBase()
// to implements a simple copy protection
// scheme. If it’s not equals to your
// URL then quit.
//
}
}
Java Codes »
Applets can read quite many of system properties by using:
String ss = System.getProperty(String key):
java.version
java.vendor
java.vendor.url
java.class.version
os.name
os.arch
os.version
file.separator
path.separator
line.separator
Java Codes »
This tip shows how to decode the parameters passed in the URL.
import java.applet.*;
import java.util.*;
public class SimpleApplet extends Applet {
Hashtable searchparms;
public void init() {
