简体   繁体   中英

Do I have to learn AWT before learning Swing?

If I want to code an desktop application in Windows with Java, should I buy a book about Swing and just skip reading books/tutorials about AWT?

Or do I have to learn AWT before using Swing?

Just go straight to Swing .

Ignore awt .

There is no benefit getting your head around awt, as Swing is essentially a replacement for it.

There's really no point in learning AWT first. Swing replaces a lot of AWT's concepts and components, but integrates many others unchanged (such as layout managers). If you learn Swing, you'll learn those parts of AWT that still matter (and how they are used in Swing) pretty much automatically.

Sun's Swing tutorial is a pretty good starting point.

If you're doing this for yourself (and not part of work), might I suggest trying out the Qt or Gtk Java ports?

I don't know much about the Gtk one, but the Qt one is called Qt Jambi, and it's development is currently community driven, LGPL licensed. I've used both Swing (in Java) and Qt (for C++ apps), but if I ever had to develop java desktop applications again, I'd definitely give Qt Jambi a look before I decided what to pursue.

As for the Swing vs AWT - Swing straight away I would say.

Well, Swing is richer in terms of out-of-the-box components than AWT. I have used both, and i prefer Swing over AWT. Also, you do not need to learn AWT to learn Swing basics. Sun's Swing tutorial is a good source to start learning Swing framework.

As other answers have already mentioned there is no need to learn AWT and you can get your GUI coding with Swing alone.

As you develop your GUI code invariably you will bump across some AWT class (for example java.awt.event.ActionEvent) and you can comfortably use it by reading its API documentation. However your application need may make you to use a layout manager like GridBagLayout(java.awt.GridBagLayout), in which case you may have to study the layout manager documentation bit more in detail. I found this book on AWT , which is available online freely, to be quite useful when I needed to dig a bit more in detail about layout managers. 上找到了这本书,它可以在线免费获得,当我需要更详细地了解布局管理器时,它非常有用。

  1. There is no need to learn AWT before learning Swing.
  2. Net Beans is a good IDE to learn Swing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM