Chapter 8
Introducing the Graphic User Interface
These days people are accustomed to working with applications that have rich user interfaces. If you develop rich Internet applications, JavaFX is the newest platform for development offered by Oracle. But Java itself offers a library of components called Swing, which is used for building graphic user interfaces (GUIs) for desktop applications, as well as a web program called applets (see Lesson 10). In this and the following lesson you’ll learn the principles of building GUIs while developing a simple desktop calculator using the Java Swing library.
Eclipse Foundation offers another library of UI components called SWT, which is out of the scope of this book.
Swing Basics
Originally Java offered a pretty basic library of UI-related classes called the Abstract Windowing Toolkit (AWT). A couple of years later a new widget toolkit called Swing was introduced. It offers a lighter set of UI components while keeping the main idea intact — to keep UI development independent of the specifics of the end user’s operating system. Today developers are trying to create UIs that appear to be native to the OS, whether that is Windows, Mac OS, iOS, or Android. Eventually the market share of Swing-based UIs will diminish, but at the time of this writing it’s still widely used by enterprises, and skilled Swing developers remain in big demand. ...