Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Swing Still in Use Today? [closed]

Is Java Swing still in use? is the most recent post I found, and it is 4 years old (now 11 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.)

like image 206
Evorlor Avatar asked Jun 27 '14 01:06

Evorlor


People also ask

Is Java AWT still used?

The java. awt library is mostly used by tutors to make thier student familiar with the java GUI components.

Is Java Swing old?

Java Swing is said to be an old, deprecated technology to design desktop apps.

Where is Swing used?

Swing in java is part of Java foundation class which is lightweight and platform independent. It is used for creating window based applications. It includes components like button, scroll bar, text field etc. Putting together all these components makes a graphical user interface.

Is Swing better than JavaFX?

From a Java developer perspective, both technologies are highly useful in writing pluggable UI components. With its vast UI component library, Swing can provide added advantage to the developer, whereas when it comes to design modern and rich internet application, JavaFX can supersede Swing.


2 Answers

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.

like image 69
SnakeDoc Avatar answered Sep 25 '22 21:09

SnakeDoc


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).

like image 31
hanetzer Avatar answered Sep 21 '22 21:09

hanetzer