You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Applets<br />
import java.applet.*;<br />
import java.awt.*;<br />
import java.io.*;<br />
public class ResourceDemoApplet extends Applet {<br />
Image m_image;<br />
}<br />
public void init() {<br />
try {<br />
InputStream in = getClass().getResourceAsStream("my.gif");<br />
if (in == null) {<br />
System.err.println("Image not found.");<br />
return;<br />
}<br />
byte[] buffer = new byte[in.available()];<br />
in.read(buffer);<br />
m_image = Toolkit.getDefaultToolkit().createImage(buffer);<br />
} catch (java.io.IOException e) {<br />
System.err.println("Unable to read image.");<br />
e.printStackTrace();<br />
}<br />
}<br />
public void paint(Graphics g) {<br />
if (m_image == null)<br />
return;<br />
}<br />
Dimension d = getSize();<br />
g.drawImage(m_image, 0, 0, d.width, d.height, Color.white, this);<br />
I have made an applet in VJ++ which I have to sign. Is there any tool to do it (both signing and<br />
cabbing)..?<br />
Answer: Signing and archive files are two of the biggest bothers in <strong>Java</strong>. Everyone<br />
uses a different system. A good place to start is:<br />
http://www.suitable.com/Doc_CodeSigning.shtml<br />
One of the other bothers is that the unsigned window warning can't be removed by<br />
signing an applet for Internet Explorer for Macintosh. And while I am on the<br />
subject, the Windows Netscape 4.x system has a bunch of privilege calls:<br />
http://developer.netscape.com/docs/manuals/signedobj/capsapi.html<br />
and you need under most circumstances to make Microsoft specific calls too,<br />
detailed in links from:<br />
http://www.microsoft.com/java/security/<br />
Going through all this will make you want to curse. Unfortunately it is<br />
hard to pick a convincing scapegoat. It is true that Microsoft chose an<br />
entirely nonstandard CAB system, but it produces archives that are about 40%<br />
smaller than JAR files. Signing archive files is a perfect microcosm of the<br />
"freedom to innovate" controversy. Microsoft has done a better job but taken<br />
away predictability and uniformity. If the <strong>Java</strong> standards were not controlled<br />
entirely by Sun, a Microsoft competitor, perhaps everyone would be using smaller<br />
archive files by now.<br />
file:///F|/350_t/350_tips/applets.htm (3 of 10) [2002-02-27 21:17:49]