ptg7068951
230 HOUR 16:Building a Complex User Interface
The Toolapplication requires three graphics files that are used to create
the icons on the toolbar: newfile.gif, openfile.gif, and savefile.gif.
Download these files from the Hour 16 page on the book’s website at
http://www.java24hours.com and save them in the Java24project folder (or the
folder you designated for your Java projects in NetBeans).
Figure 16.3 and Figure 16.4 show two different screenshots of this applica-
tion as it runs. The toolbar has been moved from its original location (see
Figure 16.3) to another edge of the interface (see Figure 16.4).
TIP
Having trouble finding this fold-
er? Start a new project in
NetBeans: Choose File,New
Project,category Java,project
type Java application,and then
click Next. The Project Location
text field should contain the
location of the folder where
these icons should be saved.
FIGURE 16.3
Using an application with a toolbar.
FIGURE 16.4
Docking atoolbar at a new
location.
Compile the application and try it out by moving the toolbar around. You
can move a toolbar by clicking its handle and dragging the toolbar to a dif-
ferent edge of the text area. When you release the toolbar, it is placed along
that edge and the text area moves over to make room for it.
Oracle offers a repository of icon graphics that you can use in your own
programs. The three icons used in this hour’s workshop are from that col-
lection. To view the graphics, visit http://java.sun.com/developer/
techDocs/hi/repository.
NOTE
Yo u a l s o c a n d r a g a d o c k a b l e
toolbar off an interface entirely.
This causes a new window to
be opened that contains the
toolbar.