Hot Java

Hot Java This applet is “noth~l small example of the kind.of amazing performance you can squeeze out of Java if you are careful and diligent. David Lavallee uses many tricks to avoid excessive memory allocation and unnecessary calls to AWl’...

IntHash()

IntHash()  As mentioned in the preceding section, Color objects are stored in a hash table rather than creating the same ones over and over. As a further optimization, we created our own version of Java’s Hashtable class, which uses normal ints as keys rather...

update( )

update( ) Lavatron overrides update f ) to do nothing, because we don’t want AWT’s implementation to cause flicker, paint( ) The paint() method is quite simple. The first step calls copyArea( ) to all of the columns to the left by one column’s width,...

createBulbs( )

createBulbs( ) The crcatcBulbs( ) method is a helper to init( ). It returns an Image of a stack of bulb images that can be used Lomask out a column of colored squares to make them look like lit lightbulbs. It is a littletricky, but quite elegant. I First, it allocates...

The APPLET Tag

The APPLET Tag The source code starts with the APPLET lag for Lavatron, there, This applet looks best when the width is an even multiple of the bulb Size and is the bulb size times the source image heiglu. The only parameter is Ior the name of the source image file,...