Beginning Java 2- JDK 1.3 Version
Images and Animation
Exercises
- Create an applet that will create an image from a GIF file and display
four copies of it in two rows of two.
- Modify the result of the previous exercise so that the applet obtains
the URL for the image file from a
PARAM.
- Modify the last example to use the glass pane to display the sprite,
and arrange that the logo is only visible inside the circle that the sprite
rolls around. (Hint: draw an image on top of the logo with a transparent
circle.)
- Adapt the last example of the chapter to simultaneously display a
fading logo and the rotating sprite in two threads.
- The animation in the last example in the chapter could be generated by
a fixed sequence of images that repeats cyclically. Generate the animation
by creating all the images you need beforehand and making the
paint() method in the ImagePanel class display
the appropriate image.
- Modify Sketcher to support lines of various types and widths – at
least dashed and dotted lines in addition to solid lines.
- Create an applet to create a sequence of images from an arbitrary
number of GIF files, and replay them as an animation at an interval
specified by a <PARAM> tag. (Hint: you can give your GIF files names
such asimage0.gif, image1.gif, image3.gif and so on. The
getImage() method that your applet class inherits returns null
if the URL cannot be found.)
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.