Is Swing Still in Use Today?
Well, Intellij IDEA uses Swing for its UI, so I would not say that it is obsolete. Granted, I really think it could use a huge overhaul (read: something not full of spaghetti code).
Absolutely yes. Legacy swing applications are still supported and enhanced. There is no alternative for that. And if you are making applications like IDE's, SWING is still preferred. New application will of course have web-interfaces , but that really depends on the nature of the application. No generic rules.
Majority of existing GUI java codebases are Swing
and likely will stay that way until the codebase rots and nobody maintains it anymore.
Majority of new GUI java codebases are using JavaFX
, which is the Swing
replacement in Java8
and is part of the standard java library
now. It allows for CSS
skinning, HTML5
elements, and also has a very nice FXML
(a dialect of XML/HTML) which allows non-programmers to "get in there" and work on the GUI layout, etc. It also has SceneBuilder
which is a free/standard GUI drag-n-drop
builder which auto-generates FXML
for your program.
I kid not when I say FXML
can replace 3,000 lines of extended JFrame class
code for a Swing
GUI, with 50 lines of FXML
. (recent project I helped migrate).
Swing
is still used heavily, and will continue to be for a long while -- after all, it was the only choice for Java for a loooong time. JavaFX
, however, is refreshingly nice, and very-much-so worth learning.
As an aside -- Swing builds ontop of AWT - AWT has a lot of problems, most of which are marked as "wont-fix" by the java project (OpenJDK/Oracle). Swing was built to replace/fix AWT, however sometimes you will marry AWT objects into your Swing application. Heck, you will sometimes marry Swing objects into your JavaFX application. I would not bother with learning AWT, if you learn Swing, you are learning AWT for the most part. The largest difference with Swing vs AWT is Swing components start with the letter J
. EX: JFrame
vs Frame
, etc.