Java GUI Development: SWING vs. Other Libraries

In summary, the conversation discusses the various options for creating a graphic user interface in Java. The participants mention using SWING, AWT, SWT, JFace, and web technologies such as HTML, CSS, and JavaScript. They also mention the benefits and drawbacks of each option and suggest resources for learning more about Java GUI development. They mention that AWT is not commonly used anymore and recommend using Swing or a mix of technologies for web applications. They also mention the differences in creating interfaces for Android applications.
  • #1
levadny
32
16
Dear friends!

Please explain me what API/Libraries uses in Java for create graphic user interface. I use SWING but I hear that SWING is oldest technology. What you uses?
 
Technology news on Phys.org
  • #2
It really depends on what you're building but you might start with Java AWT.
 
  • Like
Likes jedishrfu
  • #3
Swing is still the thing. It's been around but GUIs don't really change that much on the application side. A smaller group of programmers have used SWT and JFace (most notably the Eclipse IDE developers its more OS native like)

Some folks have branched into web technology in which case its most likely html+css+javascript or a javascript ibrary like ExtJS or more recently Elm.
 
  • #4
I'm not a fan of AWT. Historically, Swing replaced AWT because deficiencies in it its GUI programming model. I think it was too geared toward MS Windows technology.

http://stackoverflow.com/questions/408820/what-is-the-difference-between-swing-and-awt

From this article it says Swing is more of a pure java GUI. Its the same across platforms vs AWT which changes from platform to platform.

Also for Swing, there's a nice GUI designer in Netbeans that uses drag and drop to create your GUI design. You then wire in the code behind the GUI which gets trickier. I've seen some programmers at work really do some amazing stuff with it.
 
  • Like
Likes Borg
  • #5
jedishrfu said:
Also for Swing, there's a nice GUI designer in Netbeans that uses drag and drop to create your GUI design. You then wire in the code behind the GUI which gets trickier. I've seen some programmers at work really do some amazing stuff with it.
IntelliJ has something similar but you have to be careful with the dependancies. Sometimes the IDEs create dependancies on their own jars when you use certain features.
 
  • #6
Ok. Thanks a lot for all.
I start learn Java GUI from AWT. After study SWING. And it's all.
I use java only for Win application. May bee after for android in future.
 
  • #7
One caution is to not mix AWT with Swing components as youll run into a lot of odd problems.

Also Swing is a richer set of components that look the same no matter where your app runs ie windows or macosx or linux.
 
  • Like
Likes levadny
  • #8
We used to utilize AWT more than ten years ago, to create some fancy applets. It is not used anymore by the vast majority of Java developers. Swing is still the thing as jedishrfu points out. You can start right from this in my opinion and I recommend this title https://www.amazon.com/dp/0596004087/?tag=pfamazon01-20 by OReilly publishing and of course the standard documentation from Oracle, for updated and full info. When it gets to create an interface for an app for the web, it is best to mix and match technologies and this includes Java frameworks as well.
 
Last edited by a moderator:
  • Like
Likes levadny
  • #9
levadny said:
Ok. Thanks a lot for all.
I start learn Java GUI from AWT. After study SWING. And it's all.
I use java only for Win application. May bee after for android in future.
Note that the Android GUI is a rather different beast to either Swing or AWT. Most controls behave similarly, but things like the top level Activity class are very different (unless Swing has changed a lot in the last ten years).
 

1. What is SWING and how does it differ from other GUI libraries?

SWING is a GUI library for Java that is included in the Java Development Kit (JDK). It provides a set of components for creating desktop applications, such as buttons, menus, and text fields. SWING differs from other GUI libraries in that it uses a model-view-controller (MVC) design pattern, making it easier to separate the visual components from the program logic.

2. What are some popular alternative GUI libraries to SWING?

Some popular alternative GUI libraries to SWING include JavaFX, AWT, and SWT. JavaFX is a newer GUI library that offers a more modern and customizable approach to GUI development. AWT is an older GUI library that is included in Java and provides a simpler set of components compared to SWING. SWT (Standard Widget Toolkit) is a GUI library specifically designed for creating platform-specific GUIs.

3. What are the advantages of using SWING for GUI development?

One of the main advantages of using SWING for GUI development is its cross-platform compatibility. Since it is included in the JDK, it can be used on any platform that supports Java. Additionally, SWING offers a wide range of customizable components and layouts, making it suitable for creating complex and visually appealing user interfaces.

4. Are there any limitations to using SWING for GUI development?

One limitation of using SWING is that it can be slower compared to more modern GUI libraries. This is because SWING is based on the AWT library, which was designed for older computers. Additionally, SWING may not offer all the latest features and design options that other GUI libraries, such as JavaFX, provide.

5. Can SWING be used for creating mobile or web applications?

No, SWING is primarily designed for creating desktop applications. While it is possible to use SWING for mobile or web applications, it is not recommended as there are other GUI libraries specifically designed for these purposes, such as JavaFX for mobile and HTML/CSS for web development.

Similar threads

  • Programming and Computer Science
Replies
13
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
5
Views
863
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
7
Views
493
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Mechanical Engineering
Replies
3
Views
219
Back
Top