Applicet FrameWork: Common Mistakes

  • Classpath, finding resources, and running an application from a .jar file
  • Java 2 (JDK1.2 and above) allow doubleclicking a .jar file to start a contained application (as indicated by the Main-class: classname entry in the .jar's manifest file. It is obvious that you cannot set a classpath in doing so. But even when you have a CLASSPATH environment variable, or when you execute the equivalent from the commandline Java application launcher, like

       java -classpath someclasspath -jar myjar.jar
    the classpath will be completely ignored. The .jar file is the source of all user classes, and other user class path settings are ignored. In fact, the classpath is set to just myjar.jar.

  • It is wrong to believe everybody understands English
  • I guess programmers are the most likely people to know English, if it were only to understand their Cobol syntax. But I have worked with programmers from countries like Italy, France, Germany, Spain, ..., and many of them DO NOT UNDERSTAND ENGLISH. They even invent translations for computer terminology! So please use the Internationalization functionality of the Applicet Framework.

  • Consuming all user input blocks normal Applicet shutdown
  • In oh so many applets we see code like (using the old event model, so be it) :

    	public boolean keyDown(java.awt.Event evt, int key) {
    		switch (key) {
    			case oneOfMyKeys: 
    				doit; break;
    			default:
    				break;//do nothing
    		}
    		return true;
    	}
    

    Good (;-) Java programmers however return true only if they handle the key, and want to retain other event handlers from doing so. So please change this to

    			...
    			default:
    				return false;
    			...