Introduction to GUI

"The cow was outstanding in her field." —Unknown


In this chapter we will look at what Java has to offer with its built-in GUI packages AWT and Swing and how we can use them, abuse them, and then disown them. We will also learn to create our own GUI system to get around the frailties of the Java GUI system. GUI is sometimes overlooked in game development, but every game really requires a GUI system. As you may know already, GUI is an acronym for graphical user interface and is the general name for all the widgets, such as buttons and scroll bars, that are commonly found in a windowed environment. Java's GUI system is very well designed and easy to use, which makes it an excellent choice for creating game tools such as map editors and the like. But when it comes to games programming, we require complete control over everything and because of the way Java is structured, using the Java GUI does not allow us complete control, which we will discuss through the course of this chapter.

First though, let's look at how we can implement a couple of the Swing GUI components (check back to , "apps and Applets," to find out more about Swing).