Note: Lecture 7 swing user interface design

[thinking before class] 1. What is swing? What are its advantages over AWT? What are the differences in use? 2. What are the characteristics of swing's component hierarchy? How is it implemented? 3. What are the common components of swing? How to use them? 4. How many containers does swing have? What are its functional features? 5. What are the characteristics of swing's layout manager that are different from AWT What are the differences?

7.1 introduction to swing

7.1. 1 Introduction in Lecture 5, we learned AWT, which is the foundation of swing. The main reason for swing is that AWT can not meet the needs of graphical user interface development. AWT was originally designed to support the development of a simple user interface for small applications. For example, AWT lacks clipboard, print support, keyboard navigation and other features, and the original AWT does not even include basic elements such as pop-up menus or scrolling panes. In addition, AWT also has serious defects. People make AWT adapt to the event model based on Inheritance and great scalability. The architecture based on peer has also become its fatal weakness. With the need of development, swing has emerged. Almost all swing components are lightweight components. Compared with weight components, there are no local peer components. Unlike weight components, which need to be drawn in their own local opaque form, lightweight components are drawn in their weight component windows.

Swing is implemented in 100% pure Java, Swing component is a light-weight component implemented in Java. It has no local code and does not rely on the support of the operating system, which is the biggest difference between swing component and AWT component. Because AWT component passes through peer classes related to specific platforms (peer) implementation, so swing is more practical than AWT components. Swing performs consistently on different platforms and has the ability to provide other features not supported by the local window system.

Swing adopts an MVC design paradigm, namely "model view controller", in which the model is used to save content, the view is used to display content, and the controller is used to control user input.

In AWT components, because the peer class that controls the appearance of components is related to the specific platform, AWT components always have only the appearance related to the machine. Swing enables programs to look different when running on a platform. Users can choose the appearance they are used to.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>