Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Want to improve this question?
Update the question so it can be answered with facts and citations by
editing this post
.
Closed
2 years ago
.
I am planning on making a Java Swing application and was wondering if Swing is still used or if it has been replaced with something else.
Thanks in advance!
–
Speed: use of native peers speeds component performance.
Look and Feel: AWT components more closely reflect the look and feel of the OS they run on.
Cons:
Portability: use of native peers creates platform specific limitations. Some components may not function at all on some platforms.
Third Party Development: the majority of component makers, including Borland and Sun, base new component development on Swing components. There is a much smaller set of AWT components available, thus placing the burden on the programmer to create his or her own AWT-based components.
Features: AWT components do not support features like icons and tool-tips.
Portability: Pure Java design provides for fewer platform specific limitations.
Behavior: Pure Java design allows for a greater range of behavior for Swing components since they are not limited by the native peers that AWT uses.
Features: Swing supports a wider range of features like icons and pop-up tool-tips for components.
Vendor Support: Swing development is more active. Sun puts much more energy into making Swing robust.
Look and Feel: The pluggable look and feel lets you design a single set of GUI components that can automatically have the look and feel of any OS platform (Microsoft Windows, Solaris, Macintosh, etc.). It also makes it easier to make global changes to your Java programs that provide greater accessibility (like picking a hi-contrast color scheme or changing all the fonts in all dialogs, etc.).
Cons:
Performance: Swing components are generally slower and buggier than AWT, due to both the fact that they are pure Java and to video issues on various platforms. Since Swing components handle their own painting (rather than using native API's like DirectX on Windows) you may run into graphical glitches.
Look and Feel: Even when Swing components are set to use the look and feel of the OS they are run on, they may not look like their native counterparts.
–
–
–
–
Swing is still there and well supported.
Most of the reasons why people hated swing when it first came out are no longer valid simply because of Moores Law, along with improved JVMs. Swing apps no loger feel jerky and unrepsonsive and an accumulation of minor improvements result in a more professional looking GUI.
Its also worth looking at the "groovy/swing" combination for rapid development and prototyping.
–
–
We still use it. Not everything is a web app, so far there have been some tentative replacements (such as SWT, which eclipse is written in)
SWT has a native layer that wraps the underlying calls to the native windowing layer. It only works for a limited set of platforms and of course requires some third party shared libraries. I would venture to say that there are far fewer SWT apps than Swing apps.
Yes, it still is in use. The library is still part of the JRE, and will probably be that way for the future. There are other options though. For instance, you may want to look at JavaFX if you need a rich UI; or using SWT in your application. Maybe you want some kind of 3D effects, and you need to look into a 3D engine like jpct or the jmonkeyengine. Java has progressed somewhat since the software Swing world.
–
–
You can still use Java Swing, though I'd recommend using JavaFX. Designing UIs is easier as the
SceneBuilder
helps you do just that. It is also newer, so longer support and development. The advantage of Swing is that it has been out for quite a long time, so you'll find more tutorials and help for Swing, but JavaFX is catching up. If you'd like to learn JavaFX, I recommend following the
tutorial series
by thenewboston on YouTube.