Applets
Answer: The first thing a JVM does when it loads a class is check that the first four bytes are (in hex)
CA FE BA BE. This is the "magic number" and thats why you are getting that error, you are trying to
load a file that isnt a class and so the class loader in the JVM is throwing out that exception.
Make sure you transfer the class files to site in binary mode, rather than text or ASCII mode. 
An error from the browser saying "cannot start applet ... bad magic number" usually means that one of
the class files on the server is corrupted.  
Replace your class binary files on the web server; clean up the cache of your browser, and reload
your applet.
Q: I want to use more fonts in my applet... say for example Arial... which is not avilable in the
present jdk package...
 How can i deal with it?
Answer: import java.awt.Toolkit;
....
Toolkit tools : new Toolkit();
String[] fontList = tools.getFontList();
 Q: How can I slow down my applet?
I have a game applet that is running too fast on newer systems that have high end video cards. Its
easy enough to slow down the game by having it sleep between thread cycles, but I need to be able
to
determine how fast a users machine is before I determine how long to sleep for.
I have been muddling through the documentation but cannot find any calls that will tell my applet what
the users configuration is as regards to CPU speed and other components they may have on their
system.
Answer: Simple create a new Date (), then perform a standard lengthy operation on the order of
something that takes about one second on your machine, like a long loop, then create another new
Date() and compare it to the first. If it takes 1/2 of the time compared to your machine, then the CPU
is probably about 2 times faster. if it takes 3 times the duration compared to your machine, the CPU is
probably 1/3 as fast as yours.
Do this dynamically, and it might help with speed changes when there s lots of action happening as
well   unless this issue is already being dealt with using threads, that is.
  
by Max Polk
Q: Why do I see applet in applet viewer and do not in a browser?
When I try to view my applet on a web page i get the error
java.lang.NoSuchMethodError: java/lang/Double: method
parseDouble(Ljava/lang/String;)D not found
Which is weird as it compiles fine on Borland and with the JDK using applet viewer
Anyone have any ideas what is going wrong?
Answer: The parseDouble method was only added to Java in JDK 1.2
Browsers typically only support Java 1.1 
If you have the JRE installed, you can run Java 1.2 applets. But you must also change the HTML
code that embeds the applet. Check javasoft.com. I believe they have a program which will
automatically change the  tag to  and add whatever else is needed. It s been a
file:///F|/a_jsite/350_tips/applets.htm (4 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