In Java Graphical User Interface (GUI) programming, we do not build GUI components from scratch. Instead we use GUI components provided to us by the JDK. Java has two types of GUI applications: stand alone GUI applications and applets. We first study how to build stand-alone GUI applications (GUI app for short).
Every GUI app uses what is called a JFrame that comes with the JDK. A JFrame is a window with borders, a title bar, and buttons for closing and maximizing or minimizing itself. It also knows how to resize itself. Every GUI app subclasses JFrame in some way to add more functionality to the window frame. One common task is to tell the system to terminate all "threads" of the GUI app when the user clicks on the exit (close) button of the main GUI window. We encapsulate this task in an abstract frame class called AFrame described below.
- 瀏覽次數:1366