aspose file tools*
The moose likes Java in General and the fly likes GUI : how popular is Swing for desktop apps ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "GUI : how popular is Swing for desktop apps ?" Watch "GUI : how popular is Swing for desktop apps ?" New topic
Author

GUI : how popular is Swing for desktop apps ?

Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

It seems that swing is not preferred for GUI in desktop apps. Is swing avoided in general ? Can anyone shed some light on this ?
Also, i hardly come across applets. Are there any better alternatives to java applets ?



SCJP 6. Learning more now.
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
waiting for replies
BTW: Can awt finish all the job that the swing can finish?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14266
    
  21

Why do you think that Swing is not preferred for the GUI in desktop apps? And if Swing is not preferred, what do you think is used instead?

I don't think there's anything wrong with Swing for desktop apps. There is now also JavaFX, which might sometime in the future be more widely used for desktop apps, but at the moment JavaFX seems to be used almost nowhere. Oracle is working on JavaFX 2.0 but it will not be out soon, as far as I know.

There are big programs, such as NetBeans, which are based on Swing.

When Java was new, in 1996 or so, the web was also new, and Java was marketed as something that you could make interactive websites with. However, applets never became really popular, one of the reasons was that Java made the impression of being a heavy thing, and even now if you have a website with a Java applet it takes some time to load the applet before it starts up. Flash (from Adobe) won the battle over Java for interactive websites. And today's browsers support HTML5 and have fast JavaScript engines, so more and more interactive websites work using that.

ken: One of the major differences between AWT and Swing is that AWT uses the GUI components of the operating system directly, while Swing draws all the components itself. Because of that, with AWT it is almost impossible to change the style of the GUI, while Swing supports pluggable look-and-feels that can easily change how the application looks.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
Jesper thanks for your reply
Neglecting the function of changing looks ,can Swing have some unique features like a menu or a list(just an example ingore true or false) that AWT didn't have?
I have learn about how to write AWT but don't know the details writing Swing, though there is not any differences. Is Swing more important in J2SE than AWT ? Which one use more in making GUIs in J2SE? Is GUI in J2SE useless in some aspect, I mean whether making GUI in desktop use more C/C++ than J2SE?

thanks.
ken
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
Jesper an other question . Is applet in a disadvantage road fighting with flash according to your reply just now? What's your opinion about the future of applet.

Thank you again.
ken
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

For desktop applications, Swing is still one of the most-used frameworks. I think SWT is another one that's used a lot. AWT is outdated and should no longer be used.

As for applets, if you want to embed your Java application in HTML pages then applets are the only option. There are other options like Flex and Flash, but these aren't Java. JavaFX can be used but for web pages it will create an applet in the end.
JNLP / Webstart can be used to launch applications through the Internet, but they won't be part of your HTML page but have a separate window instead.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

ken jun wrote:Jesper thanks for your reply
Neglecting the function of changing looks ,can Swing have some unique features like a menu or a list(just an example ingore true or false) that AWT didn't have?

Swing has everything AWT has; usually the class has the same name with a J in front (Frame - JFrame, Button - JButton, Menu - JMenu, List - JList). Choice / JComboBox is one of the few exceptions to this "rule".

I would definitely read the Java tutorials on Swing on Oracle's website, and your migration from AWT to Swing shouldn't be too hard. They both use the same event handling mechanism, Swing just adds a lot more, but it still uses golden oldies like ActionListener and MouseListener.
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

Jesper de Jong wrote:Why do you think that Swing is not preferred for the GUI in desktop apps? And if Swing is not preferred, what do you think is used instead?


I mostly find software in .msi or .exe form. Rarely jar. Also, I heard that visual c++, c# are used. Thats why i felt that swing is not preferred.
I was wondering if JavaFX is a replacement for swing ? If so, then i might learn FX instead of swing.
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

Rob Spoor wrote:For desktop applications, Swing is still one of the most-used frameworks. I think SWT is another one that's used a lot.


Please tell me the names of some popular desktop apps that use swing.
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
Rob Spoor wrote:
ken jun wrote:Jesper thanks for your reply
Neglecting the function of changing looks ,can Swing have some unique features like a menu or a list(just an example ingore true or false) that AWT didn't have?

Swing has everything AWT has; usually the class has the same name with a J in front (Frame - JFrame, Button - JButton, Menu - JMenu, List - JList). Choice / JComboBox is one of the few exceptions to this "rule".

I would definitely read the Java tutorials on Swing on Oracle's website, and your migration from AWT to Swing shouldn't be too hard. They both use the same event handling mechanism, Swing just adds a lot more, but it still uses golden oldies like ActionListener and MouseListener.


smashing reply thanks.
I have to try coding Swing instead of AWT....
BTW:neglecting whether the look can changable or not why AWT is outdated? Could you give me some tips
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

If you want to know popular software written in Java, just check SourceForge.net.

As for why AWT shouldn't be used, that's simply because you can do almost anything you can do in AWT in Swing as well, but vice versa it's a lot harder. JTable, JTree, JSplitPane, those are just a few components without AWT equivalents.

Note that AWT sometimes still comes in handy, but only in the few areas where Swing has no equivalent. SystemTray / TrayIcon comes to mind.
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
Rob Spoor wrote:If you want to know popular software written in Java, just check SourceForge.net.

As for why AWT shouldn't be used, that's simply because you can do almost anything you can do in AWT in Swing as well, but vice versa it's a lot harder. JTable, JTree, JSplitPane, those are just a few components without AWT equivalents.

Note that AWT sometimes still comes in handy, but only in the few areas where Swing has no equivalent. SystemTray / TrayIcon comes to mind.


Rob thank you
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

You are still writing desktop apps? Not me, I haven't written a serious one in at least a decade. Same for applets. They were cool technology last century. Everything I've written this century has been web-apps, Java back end, HTML front end, these days with lots of javascript.

Obviously, YMMV.
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
Pat Farrell wrote:You are still writing desktop apps? Not me, I haven't written a serious one in at least a decade. Same for applets. They were cool technology last century. Everything I've written this century has been web-apps, Java back end, HTML front end, these days with lots of javascript.

Obviously, YMMV.


your means is that J2EE and J2ME are the most powerful thing of JAVA? I have heared J2EE is hard to learn.......I really don't understand what's it merely know is Enterprize Edition and is network oriented
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

ken jun wrote:your means is that J2EE and J2ME are the most powerful thing of JAVA? I have heared J2EE is hard to learn.....

I said no such thing. And it has not been called J2EE for years because J2EE was terrible, hard to learn, hard to use.

All of my code, and much (most?) modern Java code is web based. The code uses Servlets and JSP, and of course normal Java classes. There are sections here on the ranch dedicated to Servlets and to JSP.

The future of computing is mobile, smart-phones and tables. Android is developed in a Java-like language.
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
Pat Farrell wrote:
ken jun wrote:your means is that J2EE and J2ME are the most powerful thing of JAVA? I have heared J2EE is hard to learn.....

I said no such thing. And it has not been called J2EE for years because J2EE was terrible, hard to learn, hard to use.

All of my code, and much (most?) modern Java code is web based. The code uses Servlets and JSP, and of course normal Java classes. There are sections here on the ranch dedicated to Servlets and to JSP.

The future of computing is mobile, smart-phones and tables. Android is developed in a Java-like language.


according to your opinion what people usually call ME SE EE nowadays? Could you tell me please? Andrioid , in my opinion, although is open source now, but I think it will keep the kernel secret and sell it for money in the future. haha
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

We are a friendly place here at the ranch, and we have a very wide international audience. So we get used to folks who are not native speakers. But I am not understanding what you are asking, @ken.

You seem to be focused on buzzwords. I pay little attention to them and other labels, because most are just creations of marketing folks, have little to do with the technical issues that I follow, and most go away quickly. J2EE is a classic example, it arrived with much fanfare, the marketing folks talked a lot about it, but it was a disaster technically. Nobody talks about Enterprise Java Beans anymore.

Android is open source. The operating system is Linux based. Folks write applications in a Java-like language. For anyone except the lawyers, you write in Java. But the Oracle/Sun legal terms prevented Google from doing some of the stuff they wanted, so instead of using Java's JVM, you use Dalvik. And technically, the Java libraries supported by Dalvik are not JSE, JME, or other stuff, they are new and unique. In practice, 99% of the usual stuff is there and works just the same. I'm an engineer, not a lawyer, and perhaps you can't even say you write Java on Android, perhaps you have to legally say you write in Dalvik.

The labels are pretty useless.


Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

Pat Farrell wrote:
Nobody talks about Enterprise Java Beans anymore.


Its off topic. But, why do you say that ? Where did you get that information ?
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Rahul Sudip Bose wrote: Its off topic. But, why do you say that ? Where did you get that information ?


OT, but its just what I hear or don't hear in the circles I travel in.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

EJB1 and EJB2 scarred people for life, and despite the simplifications of EJB3, most developers of my acquaintance avoid it like the plague. Most who want EJB-like features are using Spring and Hibernate instead, or just forgoing large frameworks.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Bear Bibeault wrote: most developers of my acquaintance avoid it like the plague. Most who want EJB-like features are using Spring and Hibernate instead, or just forgoing large frameworks.


Exactly what I do, and all the folks that I hang with. I run, running hiding, and screaming, from the mention of EJB. Hibernate is OK,but I don't love it. I do love Bear's FrontMan, much lighter than Spring.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14266
    
  21

Rahul Sudip Bose wrote:I mostly find software in .msi or .exe form. Rarely jar. Also, I heard that visual c++, c# are used. Thats why i felt that swing is not preferred.
I was wondering if JavaFX is a replacement for swing ? If so, then i might learn FX instead of swing.

But .msi or .exe are ofcourse Windows-only programs. Ofcourse many programs for Microsoft Windows are build using Microsoft technologies such as .NET (with code written in C# or C++). On the Mac, many people are using Apple's software development kit and write code in Objective-C.

Java has never become really very popular for desktop applications, but it doesn't mean you can't create desktop applications in Java. Examples are the big IDEs, NetBeans, Eclipse and IntelliJ IDEA. The Vuze bittorrent client is another example of a sophisticated Java desktop app. If you want to create a cross-platform desktop app then I think writing it with Java / Swing is not a bad option.

JavaFX version 1.x has failed. Now Oracle is busy inventing JavaFX 2.0 which will be totally different (for example they are getting rid of the JavaFX Script programming language that came with JavaFX 1.x) but it isn't there yet, and I think it's going to take a long time before there is a usable version of JavaFX 2.0, and it's absolutely not clear that this is going to be adopted by developers. So, it's too early to focus on JavaFX 2.0 right now.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
Cyberduck is a very capable FTP/SFTP/WebDAV/S3 etc. client written largely (not completely) in Java.

If you want to create a cross-platform desktop app then I think writing it with Java / Swing is not a bad option.

An interesting alternative might be a double-clickable app that embeds a servlet container like Jetty or Tomcat (especially for someone who knows Java web apps, but not so much Swing). Then you'd use your browser pointing at "localhost:XYZ" as the GUI.


Ping & DNS - my free Android networking tools app
ken jun
Ranch Hand

Joined: Apr 23, 2010
Posts: 46
Pat Farrell wrote:We are a friendly place here at the ranch, and we have a very wide international audience. So we get used to folks who are not native speakers. But I am not understanding what you are asking, @ken.

You seem to be focused on buzzwords. I pay little attention to them and other labels, because most are just creations of marketing folks, have little to do with the technical issues that I follow, and most go away quickly. J2EE is a classic example, it arrived with much fanfare, the marketing folks talked a lot about it, but it was a disaster technically. Nobody talks about Enterprise Java Beans anymore.

Android is open source. The operating system is Linux based. Folks write applications in a Java-like language. For anyone except the lawyers, you write in Java. But the Oracle/Sun legal terms prevented Google from doing some of the stuff they wanted, so instead of using Java's JVM, you use Dalvik. And technically, the Java libraries supported by Dalvik are not JSE, JME, or other stuff, they are new and unique. In practice, 99% of the usual stuff is there and works just the same. I'm an engineer, not a lawyer, and perhaps you can't even say you write Java on Android, perhaps you have to legally say you write in Dalvik.

The labels are pretty useless.




thanks for your reply I am a beginner and just want to learn more about details about JAVA
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

ken jun wrote:thanks for your reply I am a beginner and just want to learn more about details about JAVA

We like beginners here.

Tip: focus on what you want to do, and less on the words. Some words are important for communication between us geeks, like servlets, JSP, threads, etc. But even then, what is more important than the label.
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

Bear Bibeault wrote:EJB1 and EJB2 scarred people for life, and despite the simplifications of EJB3, most developers of my acquaintance avoid it like the plague. Most who want EJB-like features are using Spring and Hibernate instead, or just forgoing large frameworks.


I saw something similar here :
http://www.indicthreads.com/1522/is-ejb-relevant-anymore/


Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

Jesper de Jong wrote:
The Vuze bittorrent client is another example of a sophisticated Java desktop app.


Thanks for that information. I tried both Vuze - java and uTorrent - C++. uT is much smaller
and much faster. Perhaps, because uT has only essential features without the "fireworks". I wonder if the speed of vuze has something to do with java ?
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Rahul Sudip Bose wrote:I wonder if the speed of vuze has something to do with java ?

This is wildly off topic, it probably belongs in Meaningless Drivel.

What, exactly, do you mean by the speed of Vuze? The speed of downloading a torrent is a function of the network. The speed of the UI, picking menu items, opening the detail view, etc. are possibly related to the use of Java and Swing/AWT. I have not noticed any speed issues with it, either in the UI or in the network download. I don't like the UI of Vuze, it has the same "minimal common subset" problem as all universal applications. It does not work like a proper OS-X application when on OS-X, it never feels like it is a native Linux application when its on Ubuntu. I've never tried it on Windows, but I bet the same holds there.

The idea that you can write one interface and have your program look and feel as if it was native is a tech unicorn that Sun over-sold in the early days of Java. It is the same unicorn that ParcPlace tried to sell about Smalltalk in the 1980s. Many people bought it, but no one has ever seen it. Unicorns are magical.
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

Pat Farrell wrote:
What, exactly, do you mean by the speed of Vuze? The speed of downloading a torrent is a function of the network.


I meant the speed with which the program opens and is ready to do its job. Its slower than uT.

PS : (This one is for the MD/General Computing) The setup is much larger and i wonder if all that extra size is needed by "useful" features of vuze.
es kranthi
Ranch Hand

Joined: Dec 27, 2010
Posts: 30
Hi,
The discussions are quite interesting a lot to know from these.

"The future of computing is Mobile"

Yes may be but this is a different context.Mobile applications cannot entirely replace Web-Applications.Both should exist because performance and memory wise ,Mobile applications need a next generation chips that can handle applications like a PC.There are several hardware issues when it comes to comes to performance.

Coming to the most used technologies today i see there is lot of need for Web-applications(also Mobile web) or Desktop applications(developed mostly on swings in my circles).I dont think that Mobile App/Software developers replace Web-application or a desktop-application developers.There is a need for both, and people use both.
John McParland
Ranch Hand

Joined: May 11, 2009
Posts: 92

I used to use Swing in a business application . The UI was webstarted from our server onto the users desktop.

However when I moved jobs, no one wanted Swing. On the desktop employers want C# .NET mostly, SWT and RCP to a lesser extent. But as a few people have noted, desktop applications aren't written so much anymore, instead we have a lot of web applications.

I think Flex (and sooner or later) HTML dominate here. Having said that, you can use either technology on the desktop (Adobe Air lets you run Flex apps on the desktop and you can use an HTML page providing you use something like Jetty as a lightweight web server.

If you are looking for technology to learn, search for jobs in your local area. Search for Java and GUI and see what technology is listed.

I hope this helps,

John


Passed: SCJP 6 (90%), SCJD 6
Other: Spring training, extensive Swing experience
Adrian Romanelli
Greenhorn

Joined: Oct 20, 2010
Posts: 3
Hello. Just wanted to add my $0.02.

I'm a freelance Java Swing programmer. Been doing so since Swing came out. I've worked for many clients, developing business applications using Swing for the front end. I'm currently working for a client developing a Swing application for the movie industry.

Someone was asking what Swing applications exist. Sun used to have a "Swing Sightings" web article that came out every month, that listed Swing applications.

Generally speaking, what I've found is that businesses use web based applications when the front end does not need to be complicated, and Swing/AWT/SWT or C#/WinForms (if you don't care about non-Windows computer) when it does.

People are looking to Adobe Flex/ActiionScript as a Swing replacement these days, but since it does not support multi-threading (Swing does), it sometimes lacks in some functionality needed for complex applications.

Microsoft makes lots of noise with Silverlight, but I haven't seen much of it being used in the Fortune 500 market. Could be wrong about that though.

JavaFX is missing some key functionality to be usable in corporate business application development, but the next version, when it comes out this year, is supposed to take care of that problem. If I understand Oracle correctly, its the assumed migration path for Swing users.

While Swing is perceived as being "old" and not used any more (do I dare say deprecated? :p ), its still being actively used in business development. Not so much as it used to be, but its still there.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4638
    
    5

Adrian Romanelli wrote:People are looking to Adobe Flex/ActiionScript as a Swing replacement these days, but since it does not support multi-threading (Swing does) ...

No, it doesn't. Java supports multithreading. Violate Swing's single threaded rule at your own risk. Better still, don't.
http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
http://java.sun.com/products/jfc/tsc/articles/threads/threads3.html
http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html

Even the few Swing methods that are documented to be thread-safe, aren't. The erroneous documentation has been corrected for Java 7.


luck, db
There are no new questions, but there may be new answers.
Adrian Romanelli
Greenhorn

Joined: Oct 20, 2010
Posts: 3
Darryl Burke wrote:
Adrian Romanelli wrote:People are looking to Adobe Flex/ActiionScript as a Swing replacement these days, but since it does not support multi-threading (Swing does) ...

No, it doesn't. Java supports multithreading. Violate Swing's single threaded rule at your own risk. Better still, don't.
http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
http://java.sun.com/products/jfc/tsc/articles/threads/threads3.html
http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html

Even the few Swing methods that are documented to be thread-safe, aren't. The erroneous documentation has been corrected for Java 7.


I was speaking generally of Java/Swing vs. Flex; just meant that I could launch threads in a Swing application to offload work so the UI continues to paint (which Flex (almost) cannot do).

But yes, you are strictly correct, its Java, and not Swing, that handles the threading, that are usable from within a Swing application (SwingWorker, Thread, etc.).
Alex Major
Greenhorn

Joined: Aug 16, 2011
Posts: 8
Here are some big-name apps written in Java that are full of eye candy. Some have quite complex UIs:

Maple Math Software -MapleSoft
LimeWire
Strata Live 3D
SuperSync- iTunes Library syncing between multiple libraries
NetBeans IDE
Eclipse IDE
http://java.sun.com/products/jfc/tsc/sightings/

Using "ancient" Java 5, I am writing a responsive and polished multi-plaform Music Notation App, with an novel user interface created using Java 2D and Swing. It can playback and display fast 32nd notes on my old 867MHz Mac from 2001. All the notes and other notation are programmatically rendered ( not a font) and can be printed for a professional score. I have all the third party libraries I need, had to pay a small amount for one of them ( under $100). It just works unchanged on Mac OS X, and Windows (untested in Linux). I could not do this feat in one code base in any other language being a team of one developer. Does anything else compare really? (not rhetorical, I'm asking). My research led me to Swing and Java 2D.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

Welcome to the Ranch!

Eclipse doesn't belong in that list. It doesn't use Swing but SWT.
Nam Ha
Ranch Hand

Joined: Aug 05, 2011
Posts: 50

Hi guys,

Swing seems a hot topic, at least in this thread.

As a Java freelance developer, I have been working on several Swing projects and see it is a good choice for desktop applications because it has a very good API: robust, well-designed, powerful (threading support), flexible (change look and feel, custom UI, ...)

I am currently working on some Swing projects now.

Anyway, Swing is still alive and live well.


Java Object Creation
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4638
    
    5

Nam Ha wrote:Swing ... is a good choice for desktop applications because it has ... powerful (threading support)


What does that mean, exactly -- threading support?
Nam Ha
Ranch Hand

Joined: Aug 05, 2011
Posts: 50

What does that mean, exactly -- threading support?

I means Swing takes advantage of Java multi-threads, compare to Flash/Flex or Silverlight which do not have multi-threads.
Alex Major
Greenhorn

Joined: Aug 16, 2011
Posts: 8
Darryl Burke wrote:What does that mean, exactly -- threading support?


Just in case we are assuming you know, see: http://en.wikipedia.org/wiki/Thread_%28computer_science%29
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GUI : how popular is Swing for desktop apps ?