Applets
while since I ve done applets but I do remember running across a similar problem.
Q: In my applet I have a bunch of gif s in my JAR file. When I try to access a gif using:
Image img = getImage(getCodeBase(), "image.gif");
everything works fine under Microsoft Internet Explorer but it does not under Netscape and
appletviewer. Of course I do not have any gifs in my CodeBase directory on server.
Any idea why?????
Answer:  Because this is not how you access resources in a Jar file. You need to use
getResourceAsStream if you want to access GIFs from Netscape. Look at:
http://developer.iplanet.com/docs/technote/java/getresource/getresource.html
for example code. This same code will work in Sun s Appletviewer.
  
David Risner
http://david.risner.org/
 Q: How do I get JVM version in Internet Explorer?
Q: When you open the Java Console through internet explorer, it prints the following useful line at the
top:
Microsoft (R) VM for Java, 5.0 Release 5.0.0.3318
We would like to be able to obtain the above String (or atleast the 5.0.0.3318 part of it) through a Java
Applet / Javascript at runtime. 
Does anyone know of any handy methods that allow access to this String ? I ve looked in all the
System.properties, but it wasn t there. Is it stored in the user s registry anywhere ?
Answer: just for Microsoft t VM!
try :
class test{
   public static void main(String[] args){
      String build;
      build=com.ms.util.SystemVersionManager.getVMVersion().getProperty ("BuildIncrement");
      System.out.println("Using build "+build);
   }
}
Real Gagnon from Quebec, Canada
* Looking for code code snippets ? Visit Real s How to 
* http://www.rgagnon.com/howto.html
 Q: I wonder if there is a way to find out if a button in an applet has been clicked, no matter which
of the buttons in an applet it might be.
Of course I can write, with a particular button (if event.target==button1) but maybe there is a syntax
that looks more or less like this (it is an imaginary code just to show what I would like to do)
(if.event.target.ComponentType==Button) etc.
I tried a lot of things with getClass but none of them worked
Answer: Have your applet implement the ActionListener interface, and have every button that s
instantiated add the applet as an ActionListener. Then, inside of your applet, have the following
method:
file:///F|/a_jsite/350_tips/applets.htm (5 of 9) [2001 07 08 11:24:47]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved