Java Reference
In-Depth Information
11
Designing Graphical Interfaces
What you Will learn in this chapter:
The types of graphical user interface frameworks that exist in Java
How you can make programs with a graphical user interface
Understanding the containment hierarchy, layout managers, and
events in a GUI context
Using best practices when building graphical user interfaces
Wrox.com code doWnloads for this chapter
The wrox.com code downloads for this chapter are found at www.wrox.com/go/
beginningjavaprogramming on the Download Code tab. The code is in the Chapter 11
download and individually named according to the names throughout the chapter.
Up until now, all the programs you've been working with throughout this topic have been
rather Spartan looking. Since most of the action happened on a command‐line (or the Eclipse
console), you might be wondering whether it is possible to give your programs a bit more
visual flair, and, more importantly, make them more useful by means of adding some buttons
or a textbox or two.
Luckily, Java provides a wide range of capabilities to work with graphical user interfaces—
commonly abbreviated as GUIs—out of the box. Trying to come up with your own GUI
classes from scratch would take you many years. This also means, however, that working
with GUIs in Java is less straightforward than just dealing with input and output through
the console, and constructing visual‐rich programs will take up many more lines of code as
well. As you might expect, all the components you'll need in order to build a nice‐looking
user interface will be implemented as classes. These classes adhere to Object‐Oriented
Programming principles, so you can find your way through them using the principles you've
already learned.
 
Search WWH ::




Custom Search