Where are Swing applications used? - java

Are Swing applications really used nowadays? I don't find a place where they are used. Is it okay to skip the AWT and Swing package (I learned a bit of the basics though)?

If you are writing for the web exclusively, you can probably skip Swing, but otherwise you're absolutely going to run into it. I've never worked on a non-trivial Java app without a Swing GUI.
Also, Swing is one of the better APIs to use. If you use most others, you are going to find them more difficult to use and/or platform incompatible. (If anyone reading this is aware of exceptions to this, please leave comments, I haven't looked for a while and am kind of curious if anything better has become available)
Other JVM languages like JRuby and Jython are often used because of their access to Swing.

You may checkout Swing Sightings.
This website is hosted by SUN and it is dedicated to sw projects that use Swing.
There are a lot of projects using Swing ...
http://java.sun.com/products/jfc/tsc/sightings/

Swing is heavily used in business specific (vertical)/internal application development.

Hmmmm... how about NetBeans? You know, the IDE? It uses Swing.

Swing applications are used in most cases where a Java app runs on the desktop. Sometimes you don't even know - for example, LimeWire is a Java Swing application.
When learning Swing, you'll find that you will come to know those parts of AWT that are still important, such as Event, LayoutManager, Graphics, Font, Color, etc.

You should certainly write Swing for desktop Java, only using AWT to the degree that Swing demands it.
I'm sure people can come up with examples of very good Swing apps besides SQL Squirrel and IntelliJ.
I think that RIA technologies like Flex, Silverlight, etc. are ascendant because the web and services are taking mindshare from desktops. It's not just Swing that's losing out.

Whenever you want to write a desktop GUI app for non-Windows OS, you use Swing as the only sane and guaranteed cross-platform GUI framework.
Besides, Swing has a very good design. I recommend to learn it anyways, to make yourself a better programmer.

Check out Filthy Rich Clients. It explains some of the history of AWT and Swing. Swing, being a lightweight alternative (successor) to most of the AWT classes.

IIRC jEdit is also a Swing app. Quite a popular text editor.

Skip AWT and Swing? To jump where? SWT? Web-based development?
In the broader sense, I have a number of Java applications, although I am not too sure if they use Swing or SWT.
Lot of database tools like SQuirreL SQL Client are written in Java. I think SQuirrel uses stuff from Netbean, which is, of course, Swing based.
yEd is written in Java, probably Swing.
A number of P2P softwares are written in Java, including Frostwire (I see no trace of SWT there, but I can just miss it).
And this list is far from exhaustive!
Lol! I forgot to mention the software suite made by the company I work for! It is quite specialized, used by mobile phone companies to monitor health of their network nodes (superficially looks like a spreadsheet). Totally Swing based.

While Swing has some cross-platform look-and-feel deficiencies and it would be nice if it was updated to support generics, it is still well designed and quite usable. I have always been a fan of the sheer amount of customization offered. SWT is nice and is more native, but you give up some power and control with that as well. In addition, it seems simpler to use, which can be a plus, since Swing can be overly complex due to its flexibility.

Geertjan Wielenga often blogs about applications based on the NetBeans platform, and therefore Swing. The applications range across the board from rather small esoteric applications to very large, mission-critical systems (Boeing Aircraft comes to mind). Many of the enterprise-level applications that Geertjan misses are mentioned on Planet NetBeans. It seems like every few weeks there is an announcement or description of such a program.
As noted above, lots of tools use Swing including the IntelliJ IDEA IDE, a favorite. I'm surprised no one else mentioned it.
Sun also used to maintain a Swing Sightings web site, but it hasn't been updated in a few years.
Where I work, Swing is used in the presentation layer for a very large document management system. In my own development experience I've used Swing for desktop applications in the areas of image processing, device control (video, motors, etc.), math, statistics, and medical devices.
BTW, I agree about the slowness of file choosers. But there are lots of alternatives that will use the native file chooser. It can just be a bit jarring if the L&F's don't match up very well.
EDIT: Oh, and as others have mentioned, it's very easy to use Swing from other languages on the JVM. With Clojure, for example, it is even easier to use than in Java, in my opinion.

There is no universal question to whether it is ok to skip something or not. It's a matter of priorities. While Swing has a lot to teach you (and it is too heavily infused with AWT), if you're never going to be writing GUIs you may be better off investing in something else.
Swing, while ugly as hell, is still used in many places. A quick search on "java swing" in Indeed or dice would reveal many jobs and industries that require it.

Are you skipping it for an exam/interview? Besides really good apps like IntelliJ IDEA and NetBeans, there are lots of Swing like frameworks [SWT (Eclipse), GWT etc.] which you can learn faster with Swing knowledge...

You should probably be looking at JavaFX for future work. As the FAQ states,
Sun is not replacing Swing with JavaFX Script. Instead, JavaFX Script makes Swing easier to use.
Using/learning it will give you a very good understanding of the important Swing concepts, and how they fit in with "the future". I haven't used JavaFX yet, but heard very good things about it.

Armitage tool is made in swing , GUI tool of metasploit framework.

Related

Swing vs JavaFx for desktop applications [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a very big program that is currently using SWT. The program can be run on both Windows, Mac and Linux, and it is a big desktop application with many elements.
Now SWT being somewhat old I would like to switch to either Swing or JavaFX. And I would like to hear your thoughts on three things.
My main concern is what will be better for a desktop GUI application? (I looked online and a lot of people suggest that JavaFX is just as good as Swing, but I didn't see many valid arguments except simple opinion flame wars). It has to work on both Windows, Mac and some popular Linux distributions.
What will be cleaner and easier to maintain?
and what will be faster to build from scratch?
I am using MVC methology in my application, if that is of any help.
What will be cleaner and easier to maintain?
All things being equal, probably JavaFX - the API is much more consistent across components. However, this depends much more on how the code is written rather than what library is used to write it.
And what will be faster to build from scratch?
Highly dependent on what you're building. Swing has more components around for it (3rd party as well as built in) and not all of them have made their way to the newer JavaFX platform yet, so there may be a certain amount of re-inventing the wheel if you need something a bit custom. On the other hand, if you want to do transitions / animations / video stuff then this is orders of magnitude easier in FX.
One other thing to bear in mind is (perhaps) look and feel. If you absolutely must have the default system look and feel, then JavaFX (at present) can't provide this. Not a big must have for me (I prefer the default FX look anyway) but I'm aware some policies mandate a restriction to system styles.
Personally, I see JavaFX as the "up and coming" UI library that's not quite there yet (but more than usable), and Swing as the borderline-legacy UI library that's fully featured and supported for the moment, but probably won't be so much in the years to come (and therefore chances are FX will overtake it at some point.)
As stated by Oracle, JavaFX is the next step in their Java based rich client strategy.
Accordingly, this is what I recommend for your situation:
What would be easier and cleaner to maintain
JavaFX has introduced several improvements over Swing, such as, possibility to markup UIs with FXML, and theming with CSS. It has great potential to write a modular, clean & maintainable code.
What would be faster to build from scratch
This is highly dependent on your skills and the tools you use.
For swing, various IDEs offer tools for rapid development. The best I personally found is the GUI builder in NetBeans.
JavaFX has support from various IDEs as well, though not as mature as the support Swing has at the moment. However, its support for markup in FXML & CSS make GUI development on JavaFX intuitive.
MVC Pattern Support
JavaFX is very friendly with MVC pattern, and you can cleanly separate your work as: presentation (FXML, CSS), models(Java, domain objects) and logic(Java).
IMHO, the MVC support in Swing isn't very appealing. The flow you'll see across various components lacks consistency.
For more info, please take a look these FAQ post by Oracle regarding JavaFX here.
JavaFX Frequently Asked Questions
No one has mentioned it, but JavaFX does not compile or run on certain architectures deemed "servers" by Oracle (e.g. Solaris), because of the missing "jfxrt.jar" support. Stick with SWT, until further notice.
I don't think there's any one right answer to this question, but my advice would be to stick with SWT unless you are encountering severe limitations that require such a massive overhaul.
Also, SWT is actually newer and more actively maintained than Swing. (It was originally developed as a replacement for Swing using native components).
On older notebooks with integrated video Swing app starts and works much faster than JavaFX app. As for development, I'd recommend switch to Scala - comparable Scala Swing app contains 2..3 times less code than Java.
As for Swing vs SWT: Netbeans GUI considerably faster than Eclipse...
I'd look around to find some (3rd party?) components that do what you want. I've had to create custom Swing components for an agenda view where you can book multiple resources, as well as an Excel-like grid that works well with keyboard navigation and so on. I had a terrible time getting them to work nicely because I needed to delve into many of Swing's many intricacies whenever I came upon a problem. Mouse and focus behaviour and a lot of other things can be very difficult to get right, especially for a casual Swing user. I would hope that JavaFX is a bit more future-orientated and smooth out of the box.

JavaFX and Swing --- finding a middle ground?

I am so-so with Swing and just starting to learn JavaFX. I went over a few answers on SO with regards to which one to use and I still can not make up my mind.
Is it possible to get the best of both the worlds ??
Like, use JavaFX with I want to give some visually appealing graphics and add some Swing to JavaFX when I want to ?
You can use JavaFX in Swing applications via the JFXPanel control. See the SwingInterOp sample. You can also utilize JavaFX from inside sophisticated Swing based platforms such as NetBeans RCP.
A current limitation of JavaFX/Swing integration is that you can embed JavaFX components in a Swing application, but not Swing components in a JavaFX application. RT-12100 Swing in JavaFX embedding support is currently scheduled for Java 8.
If you have a green field new application to develop, I'd advise choosing one technology or the other and sticking with that or at least keeping the integration points localized and few and far between. Both frameworks are large and take time to learn, plus you will avoid any integration headaches such as needing to take care that Swing processing is done on the Swing Event Dispatch thread and JavaFX processing is done on the JavaFX Application Thread.
JavaFX also integrates with SWT and that integration is currently simpler than the JavaFX/Swing integration (because there is only a single GUI thread to worry about).
Here is a screenshot of JavaFX/Swing interop sample from Oracle:
I went over a few answers on SO with regards to which one to use and I still can not make up my mind.
Rather than doing that, I'd advise picking a small application and implementing it from scratch in Swing and JavaFX and seeing which you prefer. It's time better spent as there is no substitute for hands on experience - then, if you still have questions (hopefully more specific and targeted), come back to StackOverflow to research or ask them.
It depends on your motivation for learning them. If you're looking primarily to boost your CV in the near future and become attractive to businesses, then (for the moment at least) there's many more applications out there written in Swing than JavaFX, purely because the latter is a much newer toolkit.
However, if you're thinking more long term or just want the best tool for the job, personally I find JavaFX to offer more flexibility, be much easier to code in an aesthetically pleasing way, and easier to learn as well (the API behind it is just much nicer.) The only thing against it at the moment is that there's some features that I'd really like to be included, but aren't yet (again, naturally this is what you get by going for the newer toolkit.)
I'd also advise against mixing the two. I'm currently involved in two projects using JavaFX, one entirely JavaFX based and the other a mixture of FX and swing. The latter is much more fiddly to maintain, primarily because of the difference in dispatch threading.
As a previous poster stated, you can use JavaFX in Swing applications now. But since Oracle has declared that JavaFX is the future of the desktop for Java, why not just learn it. I've tried to keep current on both and it's a chore. I'm planning on focusing on JavaFX exclusively in the future -- less chance of confusing myself.
That said, JavaFX still doesn't seem to be a full-fledged member of the JDK, especially if used in conjunction with other languages, like Clojure for example. Depending on the JavaFX version, there are different machinations to go through to pull it into build tools. But that situation is getting better with each release.

Java Swing : Write cross platform application (basically CRUD)

I need to write cross platform application (basically CRUD).
Is usage of Java Swing good idea? Or is it out-dated and you know better solution?
I dont want to use like 5 languages for various stuff, one or two should be enough.
Java and Swing will absolutely fit the requirement, and you will be able to make do with just the language runtime as downloaded from Oracle/Sun and nothing else. Java is one of few languages that comes with a complete and powerful GUI library of its own already included.
If I were to write a program like this these days, that's what I'd use.
Swing is complete, maintained, well documented, and implemented in Java, ensuring cross-platform portability. Most relevantly, it's part of the Java language so no other downloads for the user to manage / bloat your program.
Although the default look and feel is ugly, Java 7 is to update the default look and feel of Swing to Nimbus, which looks very glossy.
If your question relates to using the language itself, I'd say "yes". Java is, like Swing, well documented and highly developed. It may seem verbose but if there's a problem, you can sure tackle it in Java.
Personally, I've always much preferred the Standard Widget Toolkit in terms of GUI toolkits myself.
Some argument and discussion.
Java/Swing will definitely do what you want. There are other solutions such as .NET/Mono, Various cross platform GUI libraries and C++.
If I had to decide today which to use it would be Java/Swing. Java because it is better supported, Swing because it's built in and JDBC simply tips the balance away from the others.
Gavin's right +1 for the SWT. If I didn't already know Swing I'd consider SWT before making a final decision. However I do know that Swing does the job well.
Since both good java answers are already given, It should be possible to do the UI in c# as well (as long as you don't use anything Windows specific). System.Windows.Forms type applications can run on Windows, linux and Mac OS X (with mono). It does require a bit more work to get the packaging done for each platform you want to support, but it is possible.
(If you already know java you're still better off using that though as the support is better across platforms and it doesn't require your users to install mono or .net)
Java/Swing is fine. I would recommend getting a license for JFormsDesigner or one of the other UI layout tools that makes life much easier.
Also, check out SwingX which is people who work at Swing making custom controls and what not that look good and are very useful.
That's also a good place to look for best practices.
Maybe you can decouple the front end from the back by creating XML request/response streams and using web services. Then you can write the front end in whatever technology you want, as long as it uses an appropriate web client.

whether reading swing is worth it?

i planning to read swing concept, if it is worth reading ,please suggest some study material
There are too many GUI toolkits for Java since the AWT debacle. Even Swing has been seriously downplayed by critics, they have thier reasons though. But there are still lot of advantages of playing with Swing:
Inherently Swing is slightly tough to use. So once you have done through swing, you may probably get through any other technology smoothly.
Swing has a good design: Ok not from usability point of view, but still there is something really beautiful about Swing's design and approach to GUI programming. You will understand that when I tell you how many different toolkits we have integerated along with Swing, we couldnt do the same for other GUI toolkits.
Well I can assure that using Swing will improve your code-digging abilities. People who have suffered Swing would tell you :)
Note: But all this only applies, if
you have enough time and a spare job
:)
Its good to know, won't hurt.
As a Java programmer you might need to make small utility applications from time to time, so why not make them a good GUI.
Aside from that, i would suggest a graphical IDE, like Netbeans. You can use the Swing components and dig in the "auto-generated" code when you need to.
From my experiences with Swing, I think that it really depends on what you are planning on using it for. Swing was the first tool I used for designing GUI applications. I felt it was easy to use, and there is very good documentation and tutorials all over the internet on Swing. After a certain period of time, I came to realize the limitations in Swing and made a personal conclusion that Swing was a great tool for learning, and for developing small desktop applications.
Unfortunately these characteristics can only take you so far. I personally feel that Swing is limiting in that it is not a very powerful tool beyond windows and text boxes. If you are looking at doing something with the absolute most basic need of these features, then yes you would use Swing. On the other hand, if you plan on creating Powerful, professional applications, then swing might not be the tool for you to spend your time mastering. There are other tools out there that allow you to go beyond the limitations of Swing in regards functionality and efficiency.
So once again, it really depends what level you currently consider yourself, as well as what you plan on doing in the future. For everyday, "play" coding, Swing is great, but if you plan on doing anything more, then research other tools first.
Swing is necessary to learn if you wish to make desktop applications with Java. Also, it can't hurt to learn about it, as that many of the techniques used in Swing are found in Design Patterns and other GUI toolkits.

Qt Jambi vs SWT for cross-platform GUI development

I'm currently involved in a project developing applications primarily for Linux (Fedora 10). However, it might be the case later on that we will have to port these applications to Mac OS X and Windows and we don't want to be caught out by choosing the wrong GUI toolkit.*
For a variety of legacy reasons we are locked into using Java. We are in the process of deciding between using Qt Jambi and SWT for the GUI. I haven't much experience in using either of them so I'm doing some small prototypes to try and get a feel for them. So far (just developing on Linux) there isn't much difference between them. However, there's a limit to the depth I can go in a short time. This is why I'm asking for help.
The particular features of interest to us are:
Frameless windows
custom shaped windows (i.e. not rectangular)
aesthetically pleasing
Does anyone have any experiences and/or insights into these two libraries that might trip us up later?
Agile programming people will no doubt jump on the phrase "might be ... later on" and say we shouldn't worry about it. However, in the absence of other deciding factors between the toolkits, future extensibility options will do. I promise not to write any cross-platform specific code until I have to :)
Update 11 Feb: Thanks for the great answers. For those that are curious, we will probably go with Jambi. It was mostly the style sheet functionality that won me over as they make easy a lot of the custom widget shape stuff we need to do. The Qt suite of examples showed that frameless, custom-shaped windows do indeed work on different platforms, so we shouldn't be caught short down the track. The LGPL release was why we were considering Jambi at all :)
I agree with Vinegar: Don't rule out Swing. I've developed both with Swing and with SWT, but not with Qt. With Swing, your code will be automatically cross-platform. With SWT, your code is cross-platform with a little effort, although not that much effort. Are you going to implement a local application, an Applet, or a Web Start application?
The advantage of SWT is that it uses all native widgets. (familiar Look-and-feel.) The disadvantage of SWT is that it uses all native widgets. (not as many widgets as Swing has) Whether this is more an advantage or a disadvantage depends on what you are doing and what your goals are. This means that Swing has a greater breadth of widgets. However, there are a few things that SWT does that Swing doesn't do as well (or at all) -- such as launch the system's native browser and execute JavaScript scripts in this browser.
If you consider SWT, consider it carefully. If you have certain needs (such as executing JavaScript in a browser window that was launched by your application), then it may be your best choice. However, if Swing can entirely meet your needs, it may be a better choice.
Hopefully someone else can provide information about Qt Jambi.
Note that support should be a consideration in your decision. With SWT, there is a smaller community supporting it. With Swing, a larger community, but this does not mean that fixes will get more quickly into a development release. With Qt Jambi and with SWT, if a bug is fixed, you just distribute updated libraries with your application. With Swing, you have to wait for an updated JRE. Neither is necessarily a dealbreaker, but it has to be considered.
Licensing fees may or may not be a consideration. SWT and Swing, of course, do not have licensing fees Jambi I don't know about either way, but it may depend on your intended use -- for example, are you distributing a GPL application, or a commercially licensed one.
Good luck.
I have no experience with SWT, yet I was working with Jambi/Qt, Swing and GTK as well. The only problem with Qt/Jambi is licensing in my opinion (you must either publish your soft under GPL or buy commercial license). You can't start writing software for free and then "see what happens". You must be sure that your software will be success, because you have to buy licenses. This in many times is not a case.
Regards.
Ooops, I overlook those comments, thanks for the reply. This is great news! Good move from Nokia.
#cursa that wasn't said, so also note that Qt/Jambi is more than widget toolkit. You have classes for networking, strings manipulation (along with regexp engine), mutexes, 2d vector & raster graphics, openGL and many more. This gives real boost to application development.
I also recommend downloading Qt package to Jambi noobies, because of very nice help browser called Assistant which Jambi is lacking. All the API of Qt and Jambi is the same (except slots and signals), even documentation is unchanged so you can use it interchangeably.
You know Qt Jambi is discontinued following the 4.5 release this month? That doesn't make it a bad choice. Qt has other community-maintained language bindings that live outside Trolltech's control.
http://www.qtsoftware.com/about/news/preview-of-final-qt-jambi-release-available
I wouldn't rule out SWT as it is a great success in the eclipse world. I've been using it happily for about 6 years and never had to resort to swing.
I would not recommend SWT. SWT is a bad designed library with a lot of hacks and bugs. You will be looking the whole time for workaround for the simple UI-tasks

Categories