Beginning Java 2- JDK 1.3 Version Images and Animation
Summary
This chapter has been a basic introduction to handling
images and producing animations. Java provides much greater capabilities in
this area than we have looked at, but with what you now know, you should not
find it too difficult to explore those additional facilities yourself.
The important points that we covered in this chapter were:
- Implementing an applet generally involves implementing four methods
that are called by the browser or the context in which the applet is
running – the
init() method that initializes the applet, the
start() method that is called to start the applet, the
stop() method that is called to stop() whatever
the applet is doing and the destroy() method that is called
when the applet ends. You should also implement the
getAppletInfo() and getParameterInfo() methods
for your applet.
- Objects of the URL class represent uniform resource locators on the
Internet. You can define a URL in an applet either as an absolute URL, or
relative to the original URL.
- An Image object represents an image, and you can create images from
files in GIF, PNG,or JPEG format.
- The control of the timing interval for an animation generally runs in
a separate thread, and in an applet the thread is usually started in the
start() method and stopped in the stop() method.
- You can use an object of the
java.util.Timer class to
control an animation that you expedite through a TimerTask object. You can
apply Timer and TimerTask object to scheduling any operation that recurs at
a fixed time interval.
- The alpha component for a pixel specifies its transparency, where an
alpha value of zero is transparent and a value of one is opaque.
- Alpha compositing determines how the components of the pixels for a
source image are combined with the components of the destination image over
which it is rendered.
- Rendering hints provide a way for you to trade between speed and
quality in rendering operations.
- The type of line produced by drawing operations in a graphics context
is determined by the current stroke set in the context. A line type is
specified by a
BasicStroke object.
- The glass pane for a
JApplet or JFrame
object overlays the content pane, so you can draw animated elements of an
image in the glass pane and reserve the content pane for the fixed
elements. You must ensure the background to the glass pane is transparent
to enable the content pane to be seen.
- You can synthesize images by creating a
BufferedImage
object and drawing on it using the Graphics2D object that
represents the image.
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.
|