(Java)为什么有些人仍然使用awt库而不是swing?
(Java)Why some people still use the awt library and not the swing?
我经常看到有关制作 Java GUI 的 YouTube 教程,其中不使用 swing 库,而是使用 AWT 而不是 Swing。
有什么好处?缺点是什么?
我在 http://www.jguru.com/faq/view.jsp?EID=106026 上发现了 Swing 优于 AWT 的其他一些优势:
Swing provides both additional components and added functionality to AWT-replacement components
Swing components can change their appearance based on the current "look and feel" library that's being used. You can use the same look
and feel as the platform you're on, or use a different look and feel
Swing components follow the Model-View-Controller paradigm (MVC), and thus can provide a much more flexible UI.
Swing provides "extras" for components, such as:
- Icons on many components
- Decorative borders for components
- Tooltips for components
Swing components are lightweight (less resource intensive than
- Swing provides built-in double buffering
- Swing provides paint debugging support for when you build your own
components
Swing also has a few disadvantages:
It requires Java 2 or a separate JAR file
If you're not very careful when programming, it can be slower than AWT (all components are drawn)
Swing components that look like native components might not act exactly like native components
而且!习惯就是一切..他们会做他们有的事情 practice.But 我更喜欢 Swing 但我们最终需要 AWT 来处理事件或布局
我经常看到有关制作 Java GUI 的 YouTube 教程,其中不使用 swing 库,而是使用 AWT 而不是 Swing。 有什么好处?缺点是什么?
我在 http://www.jguru.com/faq/view.jsp?EID=106026 上发现了 Swing 优于 AWT 的其他一些优势:
Swing provides both additional components and added functionality to AWT-replacement components
Swing components can change their appearance based on the current "look and feel" library that's being used. You can use the same look
and feel as the platform you're on, or use a different look and feelSwing components follow the Model-View-Controller paradigm (MVC), and thus can provide a much more flexible UI.
Swing provides "extras" for components, such as:
- Icons on many components
- Decorative borders for components
- Tooltips for components
Swing components are lightweight (less resource intensive than
- Swing provides built-in double buffering
- Swing provides paint debugging support for when you build your own
components
Swing also has a few disadvantages:
It requires Java 2 or a separate JAR file
If you're not very careful when programming, it can be slower than AWT (all components are drawn)
Swing components that look like native components might not act exactly like native components
而且!习惯就是一切..他们会做他们有的事情 practice.But 我更喜欢 Swing 但我们最终需要 AWT 来处理事件或布局