Handling Action Events
Each of DownloadManager 's GUI controls registers an ActionListener that invokes its
respective action method. ActionListeners are triggered each time an action event takes
place on a GUI control. For example, when a button is clicked, an ActionEvent is generated
and each of the button's registered ActionListeners is notified. You may have noticed
a similarity between the way ActionListeners work and the Observer pattern discussed
earlier. That is because they are the same pattern with two different naming schemes.
Compiling and Running the Download Manager
Compile DownloadManager like this:
Run DownloadManager like this:
javaw DownloadManager
The Download Manager is easy to use. First, enter the URL of a file that you want to
download in the text field at the top of the screen. For example, to download a file called from the McGraw-Hill web site enter
After adding a download to the Download Manager, you can manage it by selecting it
in the table. Once selected, you can pause, cancel, resume, and clear a download. Figure 33-2
shows the Download Manager in action.
The Download Manager in action
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks