Applets
Image m_image;
public void init() {
try {
InputStream in = getClass().getResourceAsStream("my.gif");
if (in == null) {
System.err.println("Image not found.");
return;
}
byte[] buffer = new byte[in.available()];
in.read(buffer);
m_image = Toolkit.getDefaultToolkit().createImage(buffer);
} catch (java.io.IOException e) {
System.err.println("Unable to read image.");
e.printStackTrace();
}
}
public void paint(Graphics g) {
if (m_image == null)
return;
Dimension d = getSize();
g.drawImage(m_image, 0, 0, d.width, d.height, Color.white, this);
}
}
I have made an applet in VJ++ which I have to sign. Is there any tool to do it (both signing and
cabbing)..?
Answer: Signing and archive files are two of the biggest bothers in Java. Everyone
uses a different system. A good place to start is:
http://www.suitable.com/Doc_CodeSigning.shtml
One of the other bothers is that the unsigned window warning can t be removed by
signing an applet for Internet Explorer for Macintosh. And while I am on the
subject, the Windows Netscape 4.x system has a bunch of privilege calls:
http://developer.netscape.com/docs/manuals/signedobj/capsapi.html
and you need under most circumstances to make Microsoft specific calls too,
detailed in links from:
http://www.microsoft.com/java/security/
Going through all this will make you want to curse. Unfortunately it is
hard to pick a convincing scapegoat. It is true that Microsoft chose an
entirely nonstandard CAB system, but it produces archives that are about 40%
smaller than JAR files. Signing archive files is a perfect microcosm of the
"freedom to innovate" controversy. Microsoft has done a better job but taken
away predictability and uniformity. If the Java standards were not controlled
entirely by Sun, a Microsoft competitor, perhaps everyone would be using smaller
archive files by now.
Mickey Segal
Q: Why do I get message like wrong magic number when I am trying to run applet? What is a
magic number?
file:///F|/a_jsite/350_tips/applets.htm (3 of 9) [2001 07 08 11:24:47]
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved