Is Java Swing still in use? is the most recent post I found, and it is 4 years old (now 14 years old), so...
Is Swing used at all in a professional environment? I am a student, and wondering if it is worth learning, or if its day has passed.
(I am not asking about a Swing-AWT comparison...just whether or not Swing is obsolete in the workforce.)
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.