Swing GUIs
NetBeans is a powerful program that offers a lot of functionality, and we access this functionality through a GUI and the menus and buttons provided by NetBeans. In theory, we could have chosen to operate NetBeans as a command-line program, but in order to use NetBeans like that, we would have to memorize or look up a large library of specific commands for every action we would want to take. A powerful and well-written application has a streamlined interface that will guide us toward important functionality and make it easy for us to access it. The JDK contains a Java extension library, the swing
library, which makes it very easy for us to wrap our own code in GUIs like the one NetBeans has.
The JFrame class
To start off on this track, we're going to write a program that will open up a new GUI window. The steps are as follows:
- At the heart of the
swing
Java GUIs is theJFrame
class. In our case, this class will be the actual window object that our operating system will handle and...