cho phép nó để truy cập dữ liệu ví dụ cho lớp bên ngoài. ✦ Bởi vì các tài liệu tham khảo ví dụ bên ngoài lớp học, bạn không thể tạo hoặc tham khảo một lớp bên trong một phương thức tĩnh của lớp bên ngoài. Tuy nhiên, bạn có thể tạo ra một lớp tĩnh bên trong, như tôi mô tả trong phần "Sử dụng lớp học Nội tĩnh" sau này trong chương này. ✦ Một trong những chính | 508 Some important Swing Concepts You Need to Know Figure 1-1 Atypical Swing window. The Swing class hierarchy The Swing API provides many different classes for creating various types of user interface elements. In this chapter I look at three of those classes JFrame JPanel and JLabel. However these three classes are part of a larger collection of classes that are all related through inheritance as shown in Figure 1-2. The Swing family tree splits at the Component class into one group of classes that are derived from the JComponent class and another branch that descends from the Window class. Figure 1-2 The Swing family tree. Some Important Swing Concepts You Need to Know 509 The following paragraphs briefly describe each of the classes shown in this figure Object All classes ultimately derive from Object so it s no surprise that this class is at the top of the tree. Component The Component class represents an object that has a visual representation that can be shown on-screen and that can interact with users. This class defines some basic methods that are available to all Swing classes. For example the setVisible method determines whether a component is visible or hidden. And the setBounds method sets the location and size of the component. This is an AWT class not a Swing class. Container The Container class builds on the basic visual capabilities of the Component class by adding the ability to hold other containers. This too is an AWT class rather than a Swing class. From this class you get the add method which lets you add components to a container. As you ll see you use this method in almost all GUI programs. Window This class defines a window which is a specialized type of container object that has a border a title bar buttons that minimize maximize and close the window and that can be repositioned and possibly even resized by the user. Frame A frame is a type of Window that serves as the basis for Java GUI applications. Frame is an AWT class that has been .