Adding Animated Movement to Your Java Application
Learn how to add animated movement into your program where multiple objects chase a lead object as it moves randomly in a given environment.
Baldwin@DickBaldwin.com
Learn how to add animated movement into your program where multiple objects chase a lead object as it moves randomly in a given environment.
Learn how to write a Java program to apply a blurring or softening filter to your digital photos. The amount of softening is controlled by the user with a slider.
Learn about color distance, projecting 3D coordinates onto a 2D display plane, and edge detection. Understanding these concepts will help you to better understand modern image processing.
Examine a new program written entirely in Java that you can use to edit the pixels in your digital photos on a pixel-by-pixel basis.
Learn more about the methods and the properties of a Turtle object from Ericson's Java multimedia library.
Learn how the World class and the Turtle class of the multimedia library implement a practical version of the Model-View-Control programming paradigm. Investigate the differences between placing a turtle in a world and placing a turtle in a picture.
Learn about the behavior of the Turtle class, its superclass named SimpleTurtle, and what they can do for you.
Learn about first-person computer games in general, and learn how to use the game-math library to write a first-person game in a 3D world in Java.
Getting started with a new technology can be daunting. Learn how you can benefit from a Java multimedia library and a lightweight Java IDE named DrJava, which has the ability to interactively evaluate Java code.
Learn how to use the dot product to compute nine different angles of interest that a vector makes with various elements in 3D space, to find six of the infinite set of vectors that are perpendicular to a given vector, and to perform back-face culling of an image.
Learn the fundamentals of the vector dot product in both 2D and 3D. Discover how to update your game-math library to support various aspects of the vector dot product. And lastly, see how to write 2D and 3D programs that use the vector dot product methods in the game-math library.
Learn how to write your first interactive 3D game using the game-math library. You will also see how to write a Java program that simulates flocking behavior such as that exhibited by birds and fish and how to incorporate that behavior in a game.
Learn how to paint images, draw graphics, and do event handling on a cell phone screen.
Learn the basics of creating your own custom GUI components by creating a pair of buttons used to turn pages.
Learn the essentials of programming the math involved in 2D and 3D game development.
Discover a Java IDE good enough to win a Dukes Choice Award at the 2007 JavaOne conference.
Learn how to use methods of the Canvas class along with methods of the Graphics class to draw text and lines on the cell phone screen. You will also see how to use anchor point coordinates to control the position of text that is drawn on the screen and how to handle keyPressed events fired by a Canvas object.
Learn how to use the game-math library for translation and animation in two dimensions.
Discover how to add commands to a MIDlet and how those commands are presented to the user in the Sun cell phone emulator. You will also learn how to produce interactive behavior within a MIDlet.
Learn how to develop a game-programming math library by adding and manipulating vectors.
Create a form in your midlets that can be populated with a variety of objects ranging from strings to images to interactive gauges.
Game programming isn't only about code. You must also have a solid understanding of the math within the code. Luckily, you can get that knowledge here.
Learn about the Choice interface and the List class including the use of implicit, exclusive, and multiple Choice types. Your Mobile apps will never be the same!
Learn how to update the game-math library to provide new capabilities including the addition of graphics and set methods for column matrices, points, vectors, and lines. Also, study sample programs that illustrate the use of the new capabilities and learn how to draw on off-screen images.
Learn how to program an Alert for a MIDlet, add an image to the Alert, add a Gauge to the Alert to act as a progress or activity meter, and how to use a Timer to control when an Alert becomes visible on the screen.
Examine two sample programs and a sample game-programming math library intended to provide aspiring game programmers with the mathematical skills required for game programming.
Learn to program MIDlet user interfaces that minimize the MIDlet's memory footprint while the MIDlet is paused making consistent use of the MIDlet class methods to satisfy the life cycle rules of MIDlets.
Learn the fundamentals of user interfaces for MIDlets, how to instantiate user interface components, how to cause them to become visible on the cell phone screen, the difference between a Screen and a Display, and much more.
Learn how the CLDC and the MIDP fit into the grand scheme of things in MIDlet programming. See how to change the behavior of a Java program by replacing the classes in the Java standard library with custom classes of your own design.
Learn how to capture and display the standard output and the error output produced by programs executing in a child process resulting from a call to the exec method.
Learn how to write a Java programming framework that makes it easy to experiment with MIDlets (Java programs for embedded devices) and the Sun Java Wireless Toolkit for CLDC (Connected Limited Device Configuration).
Understand the concept of transforms in Java 3D and learn how to write Java 3D code using that knowledge.
Gain an understanding of transforms in Java 2D in a way that you can extend to an understanding of transforms in Java 3D.
Understanding rotation and translation individually in Java 3D is not too difficult. When you combine the two, things quickly become very complicated. If you don't understand what you are doing when you combine the two, the chance that you will get it right is probably less than fifty percent. In this lesson, you will learn to get it right the first time.
Understanding the Alpha class is critical to understanding Java 3D animation. The constructors for the Alpha class can require up to ten parameters. Learn about the detailed behavior of objects instantiated from the Alpha class, with particular emphasis on understanding the behavior imparted by each of the ten parameters.
Learn how to use the RotationInterpolator and Alpha classes of the Java 3D API, along with other necessary classes, to write simple animation programs. Also learn the rationale by which those classes are used to write animation programs.
Learn to use a variety of Java 3D classes including Appearance, Transform3D, BoundingSphere, and Vector3f classes.
Learn how to master the basics of starting from scratch to create and populate a Java 3D virtual universe, and how to place that universe in a Frame object along with other GUI components using the layout manager of your choice.
Learn how to write programs that use the RescaleOp and ColorConvertOp classes of the Java 2D API to perform a variety of filtering operations on images.
Learn how to write programs that use the ConvolveOp class of the Java 2D API to perform two-dimensional image convolution. Also, learn about some of the weaknesses of the ConvolveOp class that result from a lack of options for dealing with convolution output values greater than 255 and less than 0.
Expand the JDOM/SVG graphics library to include gradients, Béziercurves, and elliptical arcs. Learn the significance of the word Scalable in Scalable Vector Graphics (SVG). Learn how to use JDOM to write XHTML output files containing SVG/XML code. Learn how to use JDOM to write Java servlets that deliver XHTML output containing SVG/XML code.
Learn a little about JDOM as an alternative to Sun's JAXP DOM API. Learn how to create an SVG file using raw JDOM commands. Learn how to write a Java/JDOM/SVG graphics library to reduce the effort required to create SVG files using JDOM and Java.
Learn how to write Java code that uses an SVG graphics library and the SVG/XML path element to efficiently draw grid lines, geometric shapes, cubic Bezier curves, quadratic Bezier curves, and elliptical arcs.
Learn how to write programs that extract Raster objects from an image and then use the BandCombineOp image-filtering class of the Java 2D API for a variety of image-processing purposes.
Learn how to write servlets that produce XHTML output containing references to external SVG files. The SVG files may be static, or they may be created on-the-fly during the execution of the servlet.
Learn how to use the LookupOp image-filtering class from the Java 2D API, along with the Random class from the java.util package to write a pair of easy-to-use programs to scramble and unscramble images in a reasonably secure fashion.
Learn how to write the Java code necessary to make effective use of the DOM class in the Google Web Toolkit.
Learn how to write Java code to produce XHTML files containing in-line SVG/XML code. Also learn how to write servlets that produce XHTML output containing in-line SVG/XML code.
Review the features of a major 3D interactive graphics Java program named Alice that is used to teach beginners how to program.
Learn how to write programs that use the AffineTransformOp image-filtering class of the Java 2D API for a variety of image-processing purposes.
Learn how to write the Java code necessary to perform drag-and-drop operations in AJAX using the GWT and Java. Also learn a little more about the use of the FocusListener and ClickListener interfaces.
Learn to write a method that deals with the escape sequences required for the quotation marks that surround attribute values in XML and a method that makes it possible to create a general node in the DOM tree being used to represent an SVG graphic.
Like the keystone in an arch, this final installment will teach about two inner classes that form the keystone of the interactive recursive filtering workbench.
Learn how to write the Java code necessary to accomplish event driven programming using the Google Web Toolkit (GWT)
Learn how to write servlets to produce SVG code that will be rendered in graphic form by an SVG-compatible browser. Also see how write your own SVG graphics library to eliminate or at least alleviate the requirement to write raw XML code or raw JAXP DOM code, making it possible for you to produce SVG output simply by making Java method calls.
Learn how to write programs that use the LookupOp image-filtering class of the Java 2D API for a variety of image-processing purposes.
Learn how to control the layout of a GWT Ajax web application using HTML layout capabilities, the capabilities of the layout classes in the GWT API, and a combination of the two. Also learn more essential aspects of the creation and deployment of GWT Ajax web applications.
Learn how to write a Java program that can be used to add five different types of visible watermarks to an image.
Learn the steps involved in getting your computer properly set up, creating, testing, and deploying GWT Ajax web applications. Create and test two simple GWT Ajax web applications in the process.
Look into the image-filtering classes of the Java 2D API. Also learn how to write a framework program that makes it easy to use those image-filtering classes to modify the pixels in an image and to display the modified image.
Learn to write and to understand the user input GUI for a Recursive Filtering Workbench. Also see how the interactive behavior of the program was accomplished using cross-linked listener objects.
Learn about a new image processing framework that provides the ability to perform two sequential processes on an image, to display the modified images resulting from each process(in addition to the original image) and to write the modified images into output files in JPEG format.
Discover the importance of the Driver Class for the Recursive Filtering Workbench in Java.
Learn how to sub-divide an image before applying a forward and inverse 2D-Discrete Cosine Transform similar to the way it is done in the JPEG image compression algorithm.
Learn how to use the forward two-dimensional Discrete Cosine Transform (2D-DCT) to compute and display the wave-number spectrum of an image. Also see how to apply the inverse 2D-DCT to the spectral data to reconstruct and display a replica of the original image.
In the second part of this two-part lesson, you will learn three ways to make use of dynamically-loaded classes.
Use this interactive workbench to gain a better understanding of the behavior of digital recursive filters. Then learn how to write the code to do recursive filtering as well as to evaluate recursive filters using a workbench-style program.
ThinWire makes it as easy to develop rich web applications as it is to write standalone Java applications. Just compile your standalone Java application using Sun's javac compiler with the three ThinWire JAR files at the beginning of the classpath and it will be turned into a web application.
Learn how to create and manually deploy four sample web applications (two are Ajax applications) in a jakarta-tomcat-5.0.27 application server. Also learn something about two competing Ajax web application development technologies. Both are based on Java source code, but each takes a different approach to the creation of the web application.
Want to learn a new programming language and looking into Open Source for an option? Python may suit your needs.
Creating scenes that appear to be three-dimensional on a flat two-dimensional screen is all about creating optical illusions. There are many important aspects to creating these optical illusions in 3D programming, not the least of which is lighting and illumination.
Learn the basics of the Discrete Cosine Transform, which is used in many applications, including JPEG image compression.
Learn how to use a Java adaptive filter to predict future values in a time series. Discover the relationship between the properties of the time series and the quality of the prediction.
Learn how to write a Java program that will automatically set the WEP, WPA, or WPA2 encryption key on a wireless router on an unattended scheduled basis.
Learn how to use the Full-Screen Exclusive Mode API to write programs that take over the entire screen. Also learn how to use active rendering as opposed to passive rendering to eliminate the overhead associated with passive rendering.
Learn how to write a program that modifies its fundamental behavior at runtime by dynamically modifying, compiling, loading, and reloading classes.
Learn how to write a Java program that exposes the inner workings of the Huffman lossless data compression algorithm. Apply the algorithm to different test messages.
Learn how to use a general-purpose LMS (least-mean-square) adaptive engine to write a Java program that illustrates the use of adaptive filtering for noise cancellation.
Part 2 of this lesson teaches you how to design copying filters, smoothing filters, sharpening filters, 3D embossing filters, and edge detection filters, and how to apply those filters to images.
Learn how to write a Java program that will help you to identify the broken bookmarks (Favorites) in your bookmark library so that you can either delete or repair them.
Learn how to design copying filters, smoothing filters, sharpening filters, 3D embossing filters, and edge detection filters, and how to apply those filters to images.
Learn how to write a Java program that illustrates lossless data compression according to the Lempel-Ziv Compression Algorithm commonly known as LZ77. Also learn about the characteristics of the algorithm that result in data compression.
Learn how to write a Java program that illustrates adaptive identification filtering and adaptive inverse filtering. Exercise the program for different scenarios.
Learn how and why image convolution works by examining the changes to the wave-number spectrum produced by image convolution. Also learn how to write the code for a general purpose image-convolution class in Java.
Learn how to use a general-purpose LMS adaptive engine to write an adaptive spectral line tracker in Java.
Learn how to use Java to create and maintain a portable bookmark (Favorites) library that will follow you from browser to browser, machine to machine, and operating system to operating system.
Learn how to use Java to create and maintain a portable bookmark (Favorites) library that will follow you from browser to browser, machine to machine, and operating system to operating system.
Learn how to write a general-purpose LMS (Least-Mean Squares) adaptive engine in Java then see how to demonstrate the use of the engine for three different adaptive programs of increasing complexity.
Learn how to write a Java program that will run in a scheduled, unattended, automated fashion to download Email messages from one POP3 server and to forward those messages to another Email server. Such a program is particularly useful for consolidating all of your Email messages onto a single Email server.
Learn how to write an adaptive whitening filter program in Java. Also learn how to use the whitening filter to extract wide-band signal that is corrupted by one or more components of narrow-band noise.
Learn how to write a program that can be used to upload legacy Email messages from local Mbox files to an Email server. Such a program is particularly useful for persons who would like to upload their collection of legacy Email messages onto Email servers such as the Gmail server.
Learn how to write a Java program that will download Email messages from one POP3 server and forward those messages to another Email account when the original server refuses to forward messages. Such a program is particularly useful for consolidating all of your Email messages onto a single Email server.
Learn how to write a Java program to adaptively design a time-delay convolution filter with a flat amplitude response and a linear phase response using an LMS adaptive algorithm.
Learn how to write Java code to hide a secret message in an image so that there is no visual indication that the image contains the message. Also learn how to write the code to extract the hidden message from the image and to reconstruct it into a readable form.
Learn how to use Java to plot millions of multi-channel data values in an easy-to-view format with very little programming effort.
Examine the code for a Java class that can be used to perform forward and inverse 2D Fourier transforms on 3D surfaces in the space domain. Also learn how the 2D Fourier transform behaves for a variety of different sample surfaces in the space domain.
Learn to write Java programs that use convolution (flat filters and Gaussian filters) to smooth or blur an image. Also learn how to write jpg files containing specialized images that are useful for testing image-processing programs.
Learn how the space domain and the wavenumber domain in two-dimensional analysis are analogous to the time domain and the frequency domain in one-dimensional analysis. You will also see some practical examples showing how 2D Fourier transforms and wavenumber spectra can be useful in solving engineering problems involving antenna arrays.
Learn how to implement a digital signature scheme with message recovery, whereby the signature can be verified without knowledge of the original message that was signed. With this scheme, signature verification also produces a copy of the original message.
Learn to write a Java program to control color intensity, apply color filtering, and apply color inversion to an image. Learn to relate the colors to points on a color wheel and points in a color cube.
Learn how to write a Java class that uses color to plot 3D surfaces in six different formats and a wide range of sizes. The class is extremely easy to use. You can incorporate the 3D plotting capability into your own programs by inserting a single statement into your programs.
Examine the code that causes a Window to gain the focus and respond to the keyboard even if that Window contains no focusable components. Also examine the code that causes a program to use extended Window state to determine that the user has maximized a Window.
Learn how to cause a Window to gain the focus and respond to the keyboard even if that Window contains no focusable components. You will also see how to cause a program to use extended Window state to determine that the user has maximized a Window.
Learn to use the SHA-1 message digest algorithm along with the RSA encryption algorithm to create and use digital signatures that conserve communication bandwidth.
Learn about the compile-time type safety provided by generics in J2SE 5.0. Along the way, you will also learn about the enhanced for loop in J2SE 5.0.
Learn how to perform matched filtering in Java. See how matched filtering often makes it possible to detect properly designed signals in noisy environments where simple frequency filtering alone cannot do the job.
With today's concerns about security, learn how to write Java code to implement the SHA-1 algorithm and how to produce message digests using that code. Understand how to use Sun's MessageDigest class to produce message digests for both the SHA-1 and MD5 algorithms.
Learn how to take advantage of time-domain convolution for frequency filtering using Java.
Learn a simple protocol for using public-key cryptography and digital signatures to protect the authenticity, integrity, and confidentiality of a message.
The processing of a key event by the focus owner is not necessarily the end of the road for that event. Learn how to cause a chain of post processors to spring into action and to perform additional processing on the event before it finally dies.
Programming in Java doesn't have to be dull and boring. Explore the underlying signal processing concepts that make the Fast Fourier Transform (FFT) algorithm possible.
See how you can use KeyEventDispatcher objects to cause a KeyEvent fired by one component to be dispatched to a different component for processing.
Delve into the general philosophy of public key cryptography. Work through sample programs that illustrate various aspects of public key cryptography through the use of the RSA algorithm as implemented using Java.
Discover how to control the contrast and brightness of an image by controlling the distribution of the color pixels. Baldwin provides and explains a Java program that can be used to experiment interactively with image contrast and brightness.
Jump into the world of forward and inverse Fourier transforms using both DFT and FFT algorithms. You will also find the implementation of frequency filtering by modifying the complex spectrum in the frequency domain and transforming the modified complex spectrum back into the time domain.
Discover how to use a feature of the focus subsystem to find the opposite component when a particular component gains or loses the focus.
Learn how to control the brightness of pixels in an image. You will see how to create a spotlight that lights up the center of an image leaving the outer edges dark.
Learn how to nest dictionaries, sort key lists, delete elements from dictionaries, and do membership testing on dictionaries.
Baldwin shows you how to download, install, and prepare a MySQL database as a localhost server on a Windows platform for use with JDBC. He then shows you how to write JDBC programs to administer the database server and to manipulate data stored on the MySQL database server.
Baldwin discusses the complex spectrum and explains the relationship between the phase angle and shifts in the time domain.
Furthering your knowledge on dictionaries, this lesson will teach you about modifying values and using tuples as keys.
Baldwin shows you how to modify an image by modifying the pixels belonging to that image. He also provides a driver program that makes it easy to modify the pixels in an image and to display the modified image.
Baldwin shows you how to use XSLT to transform an XML document into an XHTML document. He also shows you how to write Java code to perform the same transformation.
Moving deeper into dictionaries, learn the details on valid keys, key lists, and iteration on key lists.
Baldwin provides the code and explains the requirements for using spectral analysis to resolve spectral peaks for pulses containing closely spaced truncated sinusoids.
Learn about the characteristics of the Python dictionary, and how to use those basic characteristics of a dictionary.
Baldwin explains the use of base64 encoding and decoding in general, and illustrates base64 encoding and decoding using sample programs.
This lesson, which ends our miniseries on tuples, will explain indirection, and will also teach you how to use indirection to modify the value of an object referred to by a tuple item.
Baldwin explains several different programs used for spectral analysis. He also explains the impact of the sampling frequency and the Nyquist folding frequency on spectral analysis.
Combine indexing and slicing to access groups of items in nested tuples.
Baldwin explains how the Fourier transform can be used to determine the spectral content of a signal in the time domain.
Learn how to use multiple square-bracket notation for indexing nested tuples. Also see how to use the membership operation, packing a deeply-nested tuple, printing a deeply-nested tuple, and obtaining the length of a nested tuple.
Baldwin provides source code for each of the separate programs in the BigDog series of programs, along with a brief description of each program. He also explains how to set up your computer to use these programs.
Bladwin moves forward with his Python programming series by focusing on packing and unpacking tuples as well as tuple concatenation.
See how to write a Java program that mimics an XSLT transformation for converting an XML file into a text file. Once you have a library of Java methods that emulate XSLT elements, it is no more difficult to write a Java program to transform an XML document than it is to write an XSL stylesheet to transform the same document.
Baldwin explains nested top-level classes, and illustrates a very useful polymorphic structure where nested classes extend the enclosing class and override methods declared in the enclosing class.
Discover how to create empty tuples (lists whose values cannot be modified) and tuples containing only one item.
Baldwin explains a program that acts like a big ugly aggressive dog guarding your email inbox, challenging any stranger that tries to enter.
Learn how tuples (a list whose values cannot be modified) can be nested and contain other compound objects, including lists, dictionaries, and other tuples.
Baldwin shows you how to write an artificial life program that models selective breeding, sometimes referred to as artificial selection.
Tuples can provide some degree of integrity to the data stored in your Python programs. Find out how to make them do even more tricks!
Baldwin presents a program for training his SPAM screening algorithm to do a better job of identifying SPAM based on the body text of SPAM messages using actual SPAM messages in a history folder.
Learn how to further manipulate lists within Python.
Baldwin provides a much faster way for you to prevent email-borne viruses from contaminating your email inbox.
Add lists to your Python repertoire.
Baldwin shows you how to train his SPAM screening algorithm to do a better job of identifying SPAM in the future based on the subject line of SPAM messages.
Expand your knowledge of strings, and learn some concepts that will be useful with other data types as well: indexing and slicing.
With a couple of mouse clicks and less than one minute of extra effort each time you check your email, you can almost guarantee that your email data will never become contaminated by an email-borne virus.
See how the pieces become the whole in building Python programs.
Baldwin explains default XSLT behavior, and shows you how to write Java code that mimics that behavior. The resulting Java code serves as a skeleton for more advanced transformation programs.
If reusable...reusable...reusable is your mantra and want to learn Python, scripts are the way to go.
Baldwin teaches you how to write the screening module for a Java program to remove SPAM from your Email server before you download it into your primary Email client.
Baldwin shows you how to program Python using strings and literals.
Baldwin explains anonymous classes from a practical viewpoint, including a comparison between anonymous classes and local classes.
Richard Baldwin shows you how to use variables and identifiers within Python.
Baldwin teaches you how to write a Java program to remove SPAM from your Email server before it is downloaded into your primary Email client.
Learn how to use Python as a programmable calculator. In the process, you will also learn about some programming concepts, such as operators.
Baldwin shows you how to write a program to display a DOM tree on the screen in a format that is much easier to interpret than raw XML code.
This is the first in a series of online tutorial lessons designed to teach you how to program using the Python scripting language. There is something for just about everyone here. Beginners start at the beginning, and experienced programmers jump in further on.
Baldwin shows you how to use mu-law encoding and decoding to compress and restore 16-bit linear PCM samples.
There is a lot you can do with JAXP and XSLT. Baldwin shows you how to use XSL Transformations, how to create and use an identity Transformer object to display a DOM tree on the screen, how to write an output XML file, and more.
Baldwin explains the various relationships that exist among local classes and their enclosing classes.
Baldwin shows you how to (a) use JAXP, DOM, and an input XML file to create a Document object that represents the XML file, (b) recursively traverse the DOM tree, getting information about each node in the tree along the way, and (c) use the information about the nodes to create a new XML file that represents the Document object.
Richard Baldwin covers the necessary and significant aspects of OOP using C#. He begins by showing you how to get started programming with C#, and then explains encapsulation and objects.
Baldwin shows you three different ways to control the focus programmatically with Java V1.4.
Baldwin explains the various relationships that exist among member classes and their enclosing classes.
Baldwin shows you how to write an animated robot program to provide a visual demonstration of the use of a Java GUI.
Baldwin shows you how to convert audio data from one audio file type to another.
Baldwin explains the use of instance initializers, static initializers in conjunction with constructors, and the initialization of ordinary instance variables. He explains and demonstrates the order in which they are executed.
Baldwin shows you two different ways to change the focus traversal keys on an individual component at runtime.
Baldwin shows you how to use a Java robot to perform automatic testing on a Java GUI.
Baldwin explains and illustrates the use of static initializer blocks.
Baldwin explains the concept of a class and its objects from the viewpoint of a user-defined type. He contrasts user-defined types with primitive types, explains what is commonly meant by type in type-sensitive languages, and explains the similarity between variables and objects.
Baldwin shows you how to create, play, and save synthetic sounds, making use of the features of the java.nio package to help with the byte manipulations. Seven different sample sounds are provided and explained.
Baldwin shows you how to control the focusability of individual components at runtime, how to query for the currently focused Component, the default Focus Traversal Policy for Swing, and how to use the OS look and feel with Swing.
Learn how to create a Java program that will invoke mouse clicks on and enter text into non-Java programs. All this is done programmatically!
Baldwin shows you how to write more robust audio programs by using the getAudioFileTypes method of the AudioSystem class to limit the file-type choices presented to the user. This eliminates the possibility that the user will select a file type that is not supported by the system.
Baldwin shows you how to establish a focus traversal policy, and how to modify that policy at runtime.
Baldwin shows you how to use audio line events. You can use this approach to register listeners and to receive notifications whenever an audio line is opened, started, stopped, or closed.
Baldwin shows you how to write a program that you can use to play back audio files, including those that you create using a Java program, and those that you acquire from other sources.
Baldwin explains the use of properties in Java and C#, and explains the differences between the two.
Baldwin shows you how to use the Java Sound API to capture audio data from a microphone and how to save that data in an audio file type of your choosing.
Baldwin teaches you how to do frame animation. Equally important, he also teaches you about event-driven programming, multi-threaded programming, ordinary inner classes, anonymous inner classes, exception handling, and image icons.
Baldwin shows you how to use the Java Sound API to capture audio data from a microphone and how to save that data in a ByteArrayOutputStream object. He also shows you how to identify the mixers available on your system, and how to specify a particular mixer for use in the acquisition of audio data from the microphone.
Baldwin shows you how to use the Sound API to play back previously captured audio data.
Add sound to your Java application. Richard Baldwin presents the first lesson in a new miniseries that will teach you how to use the Java Sound API.
Baldwin shows you how to do memory-mapped IO for data records containing mixed types of data. He also shows you how to manipulate memory maps using view buffers such as FloatBuffer.
Baldwin shows you how write a generalized plotting program that can be used to plot engineering and scientific data produced by any object that implements a very simple interface.
Baldwin shows you how to perform memory-mapped IO in Java.
In this tutorial, Baldwin shows you how to create records consisting of mixed primitive types, how to manipulate those records under program control, and how to transfer those records between the computer's memory and a physical disk file.
Baldwin shows you how to use the FileChannel class, along with view objects of classes such as DoubleBuffer, to transfer data of all primitive types (other than boolean) between the computer's memory and a physical disk file.
Richard Baldwin walks you through a sample program that uses FileChannel objects in conjunction with ByteBuffer objects to perform read/write file IO for primitive data of type byte.
Baldwin explains the concept of channels (and other associated IO features new to version 1.4) from a read/write IO viewpoint.
With the release of JavaTM 2 SDK, Standard Edition Version 1.4 you can now write logic into your programs to analyze and make decisions on the basis of stack trace information. You can also encapsulate that information into objects. Richard Baldwin shows you how here.
Even though it is a bit late in the season to play throw and catch, Richard Baldwin shows why the practice is so important in Java.
Are you prepared to take full advantage of the new features of Java version 1.4.0? Do you work with the ByteBuffer class? Richard Baldwin explains the ByteBuffer class, which is fundamental to many of the new features in Java version 1.4.0.
Baldwin concentrates on the C# class. He shows you how to write a simple C# program and compares that program with a similar Java program.
Can the keywords this and super make your coding life easier? Richard Baldwin shows the ins and outs of these keywords and what they can do for you.
Baldwin teaches you how to use the chained exception facility that became available with release 1.4.
Richard Baldwin discusses various details regarding array objects in Java, including: members of an array object, interfaces implemented by array objects, Class objects and array objects, and the classes named Array and Arrays.
The newly released version 1.4 of Java 2 provides new features and improved performance in the areas of buffer management, scalable network and file I/O, character-set support, and regular-expression matching. The Buffer class is fundamental to many of these new features.
Discover the programming details involved in the use of array objects. Richard Baldwin presents three ways to emulate traditional two-dimensional rectangular arrays, and also shows how to create and use ragged arrays.
Discover Java Action objects and their use in Java!
Creating array objects is not done in the same manner as ordinary objects. Learn how array objects fit into the grand scheme of things in Object-Oriented Programming (OOP) using Java.
Within Java static members can be useful in some situations; however, the overuse of static members can lead to problems similar to those experienced in languages that support global variables and global functions.
Understanding interfaces is key to understanding Java. Baldwin uses a sample program to illustrate some of the things that you can--and can't--do with interfaces.
According to Baldwin, if you don't understand the Java interface, you don't understand Java. There is very little, if anything useful that can be done using Java without understanding and using the Java interface.
Sample question: What is the purpose of setter and getter methods?
Baldwin discusses the use of the Object class as a completely generic type for storing references to objects of subclass types, and explains how that results in a very useful form of runtime polymorphism.
Sample question: Is it necessary to define all versions of an overloaded method in the same class?
According to Baldwin, with runtime polymorphism, the selection of a method for execution is based on the actual type of object whose reference is stored in a reference variable, and not on the type of the reference variable on which the method is invoked.
Sample question: Is it possible to create an array object in Java whose length property value is zero? If so, list some circumstance where that may commonly occur.
Baldwin teaches you about assignment compatibility, type conversion, and casting for both primitive and reference types. He also teaches you about the relationship between reference types, method invocations, and the location in the class hierarchy where a method is defined.
Sample question: What happens if you attempt to access a Java array element outside of the array boundaries?
Baldwin explains the use of overloaded methods for the purpose of achieving compile-time polymorphism.
Sample question: What is the algorithm for rounding floating values to the nearest integer?
Baldwin shows you how to use method overriding to cause the behavior of a method inherited into a subclass to be appropriate for an object instantiated from the subclass.
Sample question: What is the scope of a variable that is declared in the first clause of a 'for' loop?
Baldwin shows you how to extend an existing class to create a new class. The new class is the blueprint for a new type. This is the mechanism for class inheritance in Java. Inheritance provides a formal mechanism for code reuse.
Sample question: What is the result of evaluating this expression: 15.5 % 1.55?
In this lesson, Baldwin concentrates on a discussion of the Java class. He shows you how to write a very simple program that simulates the manufacture and use of the car radio discussed in an earlier lesson.
Sample question: What do you get when you divide 1.0 by 3 in Java?
Baldwin kicks off a new miniseries covering the necessary and most significant aspects of OOP using Java. He begins with encapsulation and objects.
Baldwin wraps up his series of lessons on animation. He has shown you how to use Java to write programs that produce smooth animation of the sprite animation and frame animation varieties. It's time for you to take that knowledge and do something fun with it. And don't forget, Java programming can be fun.
Baldwin shows you how to achieve frame animation in Java. He accomplishes this by showing you how to upgrade the sprite animation program from the earlier lessons into a new program that provides both sprite animation and frame animation.
Baldwin completes his sprite-animation program. Along the way, he explains the methods of the Sprite class, including the following features: establishing the initial position of the sprite, determining the location of the sprite, determining the speed and direction of the sprite, updating the sprite's position, implementing some randomness in the sprite's motion, bouncing off the walls, drawing the sprite, and detecting collisions with other sprites.
In his continuing series on sprite animation, Baldwin explains the behavior of each of the methods of his SpriteManager class. This includes the following features: finding an empty location for each new sprite, updating sprite positions, drawing the new scene during each animation cycle, and managing collisions between sprites.
Baldwin shows you how to override the update method of the Component class to improve the animation quality of the program over what would normally be achieved using the default version of the update method. In the process, he shows you how to eliminate the flashing that often accompanies efforts to use the default version of the update method for animation purposes. He also shows you how to get and use an offscreen drawing context to accomplish double buffering in the drawing process.
Baldwin explains the behavior of the run method of the animation thread as well as the makeSprite method of the controlling class. He provides a preview of the SpriteManager class and the Sprite class. He discusses the repaint, update, and paint methods of the Component class, and discusses the timer loop used in this program. He also suggests an alternative approach that makes use of a Timer object to fire Action events. Finally, he recaps the previous three lessons in the series.
Baldwin explains the behavior of the run method of the animation thread as well as the makeSprite method of the controlling class. He provides a preview of the SpriteManager class and the Sprite class. He discusses the repaint, update, and paint methods of the Component class, and discusses the timer loop used in this program. He also suggests an alternative approach that makes use of a Timer object to fire Action events. Finally, he recaps the previous three lessons in the series.
In this lesson, Baldwin discusses the unusual nature of the getter methods for the width and height properties of an Image object. He introduces and briefly discusses the concept of an ImageObserver object in conjunction with the getWidth and getHeight methods of an Image object. He shows you how to set the size of a Frame to be the same as the size of a background image in the Frame. He discusses the use of an object of the controlling class as an animation thread.
Baldwin shows you how to instantiate and use a MediaTracker object to track the loading status of Image objects. He shows you how to use the getImage method of the Toolkit class to create Image objects from GIF files, how to register those Image objects on a MediaTracker object, and how to use the waitForID method of the MediaTracker object to force the program to block and wait until the images in a group are successfully loaded, or until a loading error occurs.
Programming in Java doesn't have to be dull and boring. In fact, it's possible to have a lot of fun while programming in Java. This is the first lesson in a miniseries that will concentrate on having fun while programming in Java.
Baldwin shows you how to use the more-complex version of the toArray method declared in the Collection interface. He discusses issues regarding the type of the array and the types of the objects referred to by the elements in the collection. He also discusses issues regarding the relative sizes of the array and the collection, among other things.
Baldwin shows you how to use a Comparator created by the reverseOrder method of the Collections class to sort a list into reverse natural order. He also shows you how to use the reverse method of the Collections class to reverse the order of the elements in a list.
Baldwin shows you how to use the sort method of the Collections class along with a Comparator object to sort the contents of a List into reverse natural order.
Baldwin shows you how to extract the contents of a collection into an array, and how to use a Comparator object to sort the contents of the array into reverse natural order. He also shows you how to sort the contents of the array into natural order without the use of a Comparator object.
Baldwin shows you how to use a Comparator to cause a TreeSet collection to be sorted in descending order while preserving the impact of differences in case.
Baldwin shows you how to use a Comparator object to achieve a natural ordering on a set of names added to a TreeSet collection while ignoring the case used to write the names.
Baldwin discusses and illustrates the use of the Comparator interface. The sorting order established by a Comparator may be different or may be the same as the natural order. A Comparator can be used to establish a sorting order for objects that don't have a natural ordering. The use of a Comparator is an alternative to the implementation of the Comparable interface.
Baldwin shows you why the elements stored in a TreeSet collection need to be references to objects instantiated from a class that implements the Comparable interface, and briefly discusses an alternative approach using the Comparator interface.
Baldwin explains the (lack of) interaction between the Comparable interface and the Java Collections Framework with respect to collections of type List.
A Set object cannot contain duplicate elements, but a List object can contain duplicate elements. Ordered collections are not the same as sorted collections. Specialized stipulations are placed on interfaces as you progress down the interface inheritance hierarchy of the Java Collections Framework.
The Java Collections Framework defines six core interfaces, in two distinct trees. Learn the inheritance structure and the purpose of those interfaces. Learn how the interfaces declare polymorphic methods that apply to implementations of the interfaces and learn about the optional methods of the Collection interface.
Baldwin explains that the core collection interfaces in the Java Collections Framework allow collections to be manipulated without regard for how they are implemented.
This is the third lesson in a miniseries designed to help you learn the essential features of object-oriented data structures in Java using the Collections Framework.
Baldwin explains some of the details surrounding the use of a Java collection for creating data structures. He also discusses the interfaces and the concrete implementations in the Java Collections Framework.
Baldwin introduces you to the Java Collections Framework. Once you learn how to use the framework, it is unlikely that you will need to reinvent common data structures, search algorithms, or sorting algorithms again, because those capabilities are neatly packaged within the framework.
Baldwin presents a sample enterprise bean program that you can use to hone your skills in the deployment of EJBs into the J2EE server. This bean makes use of helper classes, requiring you to take that into account in the deployment process.
True or false? Friendly or package access applies to all classes in the current working directory that are not declared to be public, private, or protected? Show off your smarts or learn a thing or two in our quiz series.
Baldwin discusses the use of J2EE as a middle-tier server in a multi-tier environment. He explains some of the benefits of the multi-tier environment in general, and the use of J2EE in particular. He discusses the general concept of a container, describes the services provided by the EJB container, and discusses how the EJB container fits into the grand scheme of things in J2EE.
Richard Baldwin presents the sixth and final article in his series on Parsing XML documents. In this article Richard covers the details of the Java code used to parse the sample XML file.
Baldwin shows you how to write and run a client application that exercises the Enterprise Bean that was deployed into the J2EE server in previous lessons. Along the way, he provides a very brief primer on JNDI.
Richard Baldwin continues his lesson on parsing XML documents with this, part 5 of six parts. In this lesson, Richard shows the effects of running the XML4J parser against a sample XML file which contains an error.
In this lesson, Richard Baldwin continues his discussion of SAX, the Simple API for XML. He also introduces you to a software product from IBM named XML for Java or XML4J for short.
True or false? Top-level classes that are declared private may be accessed only by other classes in the same package. Show off your smarts or learn a thing or two in our quiz series.
Richard Baldwin introduces the concept of event-driven programming using a very simple example. This is presented as a prelude to upcoming articles that will cover how to use a SAX parser with event-driven programming to parse and process XML documents.
In this lesson, Richard Baldwin expands on his previous lesson about event-driven programming. Using a simple applet that toggles a button's color, Richard shows you the java code involved in a simplistic event-driven application.
Richard Baldwin continues his discussion on parsing XML documents with this, the third part of six. In this lesson, Richard focuses on introducing SAX - the Simple API for XML.
Richard Baldwin provide a tutorial on sorting XML data using XSLT.
In the previous lesson, Baldwin introduced you to a very useful program that displays information about any Java component, including inheritance, interfaces, properties, events, and methods. In this lesson, he explains how the GUI for this program is set up using JFrame, JPanel, JTextArea, JScrollPane, JTextField, JButton, and JLabel components.
Baldwin shows you how to use the New Enterprise Bean Wizard to deploy your J2EE application into the J2EE server.
What do you get when you use the == operator to compare references to literal String objects that contain the same value? Show off your smarts or learn a thing or two in our quiz series.
Learn about the XSL choose command in Richard Baldwin's continuing lessons on XML and XSL.
Baldwin introduces a very useful program that displays information about any Java component, including inheritance, interfaces, properties, events, and methods. You can expand the program to provide even more information if you wish to do so.
What is the bitwise exclusive or of 5 and 7? Show off your smarts or learn a thing or two in our quiz series.
Baldwin shows you how to use the New Enterprise Bean Wizard to package your Enterprise Bean in its jar file. While not conceptually difficult, it is tedious, involving approximately ten separate operations that must be performed in the correct order.
In this first part of three, Richard Baldwin concentrates on the use of IE5 to render an XML tree into an HTML tree that is created through the transformation process.
In this second of three parts, Richard Baldwin continues the rendering of an XML tree into an HTML tree through the use of the transformation process.
In this third and final of three parts, Richard Baldwin finishes the rendering of an XML tree into an HTML tree through the use of the transformation process.
Baldwin shows you how to use custom methods that provide the functionality of glue and struts. One of the methods produces an elastic spacer component with an upper limit on how far the component will stretch. Another method provides the functionality of
In a previous article, Richard Baldwin used the xsl:for-each processing element to loop through an XML file, extracting data from that file. In this article, Richard shows how to perform a conditional test on data values to decide whether or not to insert that piece of data into an output table. Along the way, he shows you how to cause an XML data value that would otherwise be treated as a string to be treated as a numeric value for testing purposes.
What is the name of the operator that can be used to test the class of an object at runtime? Show off your smarts or learn a thing or two in our quiz series.
When using J2EE, enterprise beans must be added to a J2EE application prior to deployment. Baldwin shows you how to create a new J2EE application. Along the way, he shows you how to operate the J2EE server and provides a first look at the deployment tool GUI.
In this article, Richard Baldwin shows you how to use attribute values in the XML file to insert attributes in the output stream.
What is the maximum right shift for type int? Show off your smarts or learn a thing or two in our quiz series.
Baldwin develops three convenience methods that provide the functionality of glue and struts. These can be used as alternatives to the factory methods of the Box class used for similar purposes. They differ from the factory methods in several important respects. One of the methods makes it possible to produce an elastic spacer component (glue) with an upper limit on how far the component will stretch. Another method returns a reference to an object that provides the functionality of glue and struts in a single object.
In this article, Richard Baldwin shows you a way to insert attributes into the HTML output file. This dynamic approach can base the value of the output attribute on data values in the XML file.
In this lesson, Baldwin begins walking you through the detailed steps necessary to deploy a simple Enterprise Bean in the J2EE server. You'll learn about jar files and ear files, the deployment descriptor, J2EE applications, and the three steps required for deployment of an Enterprise Bean in the J2EE server.
Is 127 the largest positive value that can be stored in a byte type? Show off your smarts or learn a thing or two in our quiz series.
Rather than using glue and struts produced by the factory methods illustrated in earlier lessons, this program uses invisible spacer components of Baldwin's own design that behave similarly to glue and struts but provide more capability.
Is multiplication of 'char' types allowed in Java? Show off your smarts or learn a thing or two in our quiz series.
Baldwin shows you how to write a simple bean class, write the home and remote interfaces, and write and use a batch file to control the compilation process. He also discusses the life-cycle of a bean and the callback methods that the bean uses to monitor it, as well as session context, bean creation, and the EJB package.
Baldwin shows you how to control the values of these three properties. He also shows you how a BoxLayout behaves with respect to these properties when the physical size of the container is changed.
Here's the first lesson in a miniseries intended to get you up and running with Enterprise JavaBeans very quickly. We list the specific steps required to get a bean up and running, as well as the purpose and goal of EJBs.
Is the range of values for the primitive byte type is from -128 to +128? Show off your smarts or learn a thing or two in our quiz series.
This lesson will refresh your memory on how to use a Box container with its default BoxLayout manager. It will also show you how to place components on the horizontal axis and how to insert glue and struts between components.
So what's the lifetime and scope of a class variable in Java? Show off your smarts or learn a thing or two in our quiz series.
This lesson continues the discussion of J2EE and the need for standardization in multi-tier systems. It presents J2EE as the answer to the need for standardization. And it provides a simple example of the need for transaction processing involving a savings account and a checking account.
Quick question, do all Java applications and applets require a main() method? Show off your smarts or learn a thing or two in our quiz series.
This lesson shows you how to use a Box container with its default BoxLayout manager. It shows you how to place components on the horizontal axis, and how to establish their vertical positions relative to one another by setting the alignmentY property value.
Know the different ways to express the decimal value 28 as an integral literal? Show off your smarts or learn a thing or two in our quiz series.
We start with the difference between JavaBean components and Enterprise JavaBeans, discuss the Java 2 Enterprise Edition (J2EE), and move on to multi-tier systems, fat clients, and thin clients.
The purpose of this series of tutorial lessons is to help you learn Java by approaching it from a question and answer viewpoint. Here, we continue with the basics.
This lesson introduces you to the Box container and the BoxLayout manager and discusses a number of characteristics of each. Screen shots are provided that illustrate the behavior of the BoxLayout manager.
The purpose of this series of tutorial lessons is to help you learn Java by approaching it from a question and answer viewpoint.
This lesson introduces enterprise data processing, Enterprise JavaBeans, and the Java 2 Platform Enterprise Edition. It explains the differences between Enterprise JavaBeans and JavaBean components, and briefly ventures into multi-tier systems.
The factory methods of the BorderFactory class can be used to produce Border objects that are shared, and therefore can be more memory-efficient than their counterparts instantiated using the new operator. You can specify the highlight and shadow colors f
Swing compound borders allow you to combine two different border styles into a single border. Swing Border objects, including compound borders, can be nested to produce very complex borders. This lesson illustrates the use of nested compound borders.
The tutorial continues with a lesson in using XLST to create tables.
This lesson continues the discussion of the CompoundBorder class as a way to combine border styles to produce a new border style. This lesson discusses and illustrates the use of LineBorder, MatteBorder, and TitledBorder, each combined with EmptyBorder.
We introduce the CompoundBorder class as a way to combine two border styles to produce a new border style. One of the two borders serves as an inside border. The other serves as an outside border. Any two Border objects can be combined, and either can be
This lesson shows you how to use the border property to place fancy borders on Swing components. Four different standard borders have been discussed so far: EtchedBorder, BevelBorder RAISED, BevelBorder LOWERED, and EmptyBorder.
This series of tutorial lessons examines the properties of the JComponent class that are inherited by many Swing components. This lesson introduces the border property and shows how it can be used to enhance the appearance of many Swing components.
This lesson emphasizes an understanding of the opaque and preferredSize properties that are common to most Swing components.
Swing components are JavaBean Components. One of the most important things that we can do to understand Swing is to learn about the properties, events, and methods that Swing components exhibit. Many are inherited from the class named JComponent and its superclasses. These properties, events, and methods apply to Swing components as a group. Learning about the inherited properties, events, and methods, makes it possible to learn a great deal about most Swing components without having to consider them individually.
Java Programming, Lecture Notes # 1005
Java Programming, Lecture Notes # 1001
The tutorial continues with more details on using XSLT.
Baldwin shows you how to design a Bean that doesn't use design patterns, at least insofar as properties are concerned. Plus, he demonstrates how to use that Bean with JSP.
Java Programming, Lecture Notes # 1000.
Java Programming, Lecture Notes # 764
A gentle introduction to XML that discusses how document structures are facilitated.
The series builds with a discussion of content and tags, and the related topic of attributes.
A gentle introduction to XML with a look at the essential structure created by text and tags.
The series continues with a look at why XML is important, with points taken from both Microsoft and IBM.
The tutorial series concludes with a look at what constitutes "valid" and "well-formed" documents, as well as the DTD.
Java Programming, Lecture Notes # 762.
A gentle introduction to XML that discusses structured documents, plain text, and rendering.
Java Programming, Lecture Notes # 760.
This lesson will discuss the
Here's an intro to the page directive, which is used to define attributes that apply to an entire JSP page.
Here's an intro to the include directive, which is used to insert a file into a JSP page when that page is compiled.
The workhorse of JSP, a scriptlet is basically some Java code contained within a special JSP tag, embedded in an HTML page.
JSP requires you to combine Java programming syntax with special HTML syntax. This lesson will provide syntax details, with examples, for comments, declarations, and expressions.
JSPs promise to provide a capability that is at least as powerful as servlets, possibly more powerful than raw servlets, and potentially much easier to use.
Designed to soon replace java.awt.Color, the new Color class encapsulates hues in the default sRGB color space or those in arbitrary color spaces identified by a ColorSpace.
Use the setComposite() method along with the AlphaComposite class to control how new pixel values are composited with existing ones.
Here's how to use objects of the Composite interface as parameters to the setComposite() method of the Graphics2D class.
The BasicStroke class defines a set of simple rendering attributes for describing the shape of marks drawn along the outline of a Shape object.
The TexturePaint class is used to fill a Shape with a tiled version of a BufferedImage object. Here's how to put it to work.
This lesson will show you how to use the GradientPaint class to fill a Shape with a color gradient, both cyclic and acyclic.
If you want to fill a Shape object before you draw it, you accomplish this by invoking setPaint() and the fill() method on the Graphics2D object here are the details.
Learn how to create a simple Shape object with the GeneralPath class, and how to extract information from, and replicate that object using the getPathIterator() method and the PathIterator object that the method returns.
We start an explication of the Shape interface, which provides definitions for objects that represent some form of geometric shape.
This lesson will help you understand the AffineTransform class, which performs linear mapping between 2D coordinates to preserve the "straightness" and "parallelness" of lines.
In this lesson, we'll look at the fundamental class for rendering two-dimensional objects, as well as the use of the setTransform() method for setting an Affine transform.
Here, we're primarily concerned with the use of the java.awt.geom.Point2D class. We'll also illustrate the use of nested top-level classes in the Java 2D Graphics API.