Link to home
Start Free TrialLog in
Avatar of elepil
elepil

asked on

Is there any other way to create a Java GUI application other than using Swing?

I know one can use Swing to create Java GUI applications. But I've always hated Swing because I never liked how its GUI elements looked, plus it felt "sluggish" to me compared to a native Windows GUI application.

Are there any alternatives to writing GUI applications in Java other than Swing that's fast and powerful?
Avatar of gurpsbassi
gurpsbassi
Flag of United Kingdom of Great Britain and Northern Ireland image

Do it as a web application.
Avatar of CEHJ
Use a different look and feel?

Use SWT?

Use a more powerful machine?
Avatar of elepil
elepil

ASKER

CEHJ, I have never seen a Java GUI application that has really impressed me. Even NetBeans, the IDE I use, was supposed to be written in Java. When I say "sluggish", I meant that comparatively, and machine power has nothing to do with it. For example, when I try to drag a tab in NetBeans, from the time I mousedown to the time the drag confirmation comes up (which manifests itself as a red outline of the editor window I'm dragging does not come up like until 1 second later. Compare that to Windows or Mac applications where the drag icon/indicator/outline comes up instantaneously. We don't even have to talk about drag and drop, even the simple button in Swing/SWT seems to have a slight perceivable delay before the mouse over or mouse down effect comes up. It just dampens the user experience.

I don't know your technical background, but can I assume you have not heard of any alternatives other than Swing/SWT? An example is like what Qt is to C++, a library that allows C++ applications to run cross-platform (just like Java can) and is fast. Java is inherently already cross-platform, and the only thing I'm looking for is a third-party library that is fast, just as Qt is to C++.
Avatar of elepil

ASKER

gurpsbassi, I'm not sure I can connect the relevance of your suggestion to my question.
Well it should be fairly obvious that a cross-platform windowing toolkit running on a virtual machine cannot compete with native windows, other things being equal.

I too bemoan the fact that the key Java IDEs are written in ... Java
Avatar of elepil

ASKER

CEHJ, it's been a while since I made any inquiries about Java, I was hoping advancements may have been made to address the slower performance, but it's beginning to sound there hasn't been. I'll keep this post open for a short while to hear from other potential responders.

Thanks.
Swing is definitely the "lowest common denominator" approach for GUIs.  They always look terrible and feel sluggish.

I'm surprised though that you include SWT in the same bucket.  It's always felt much more like a native app to me, even if the underlying code is Java.

The code in SWT is executing native C++ libraries from the OS directly (via Java's JNI support) so it should be similar in concept to Qt.

Doug
Avatar of elepil

ASKER

dpearson, thank you for your response.

To be perfectly honest, because I haven't tried Swing or SWT, so when I see a Java GUI, I really do not know how much is Swing or SWT, or if the latter one is even involved at all.

You seem familiar with SWT. Is it cross-platform? Also, does it come with a good number of components like a data grid and tree component? And does it support drag and drop for all its components? If it feels like a native app as you say, maybe that is the answer to my question. I need to have a GUI library that has a data grid, tree, supports drag and drop, and animation (just the basics like fade in and fade out type of animation).

Thanks.
because I haven't tried Swing or SWT, so when I see a Java GUI, I really do not know how much is Swing or SWT
So how do you know it's not up to your requirements? Rumour?
Avatar of elepil

ASKER

No, CEHJ, I have tried running Java GUI applications, and I can see with my eyes.
Does your application need to be a desktop application?
I have tried running Java GUI applications
I'm now confused ...
Avatar of elepil

ASKER

CEHJ, there's nothing to be confused about.

Haven't you ever run an application on a platform that you are not developing for? I have tried running different Java GUI applications, that is, just executing them, and that is really all I need to be able to assess that it executes in a sluggish fashion.

I hope this makes it more clear to you where I am coming from.
Avatar of elepil

ASKER

gurpsbassi, ideally, I would like to be able to write Java GUI applications as a standalone desktop application. You're not suggesting an applet, are you?
No just a pure web application with a desktop like GUI.
Most applications I've seen have moved away from desktop to the web. Front end tech has come a long way over the years.
If you're comfortable with javascript, you can knock up a AngularJS application with a Java back end quite easily.
Avatar of elepil

ASKER

gur[sbassi, I have read a little about AngularJS, and I don't remember perceiving it as a GUI-like technology. If I remember right, it is all about data-binding, and it still relies on HTML and JavaScript, which would hardly make it similar to a desktop-like GUI. Or am I missing something?
True, AngularJS doesn't provide the GUI but it will provide the MVC  (or MVVM strictly speaking) architecture needed to build GUI applications with an event driven nature (similar to SWING).

The front end of Angular applications is pure HTML with CSS. You can make things pretty by using predfined css classes e.g. CSS Bootstrap

I've done quite a few projects now where the requirement was to move away from desktop application to a hosted web application.

Anyway I might be going of on a tangent here if the requirement is to build a desktop applications. At least you know there are alternatives.
There are those who think Java is dead on the desktop (client side apps/applets) and those who think it never really lived

If your experience is as negative as you make out, i'm wondering why you seem to be committed to making it behave otherwise?
Avatar of elepil

ASKER

CEHJ, I don't know why you now think I am committing, as I never said I was. I am merely exploring options. I have not kept up with technological advancements in Java GUI development and hence do not really know if it has improved. The question I posted came to my mind when I read that there is a library for C++ called Qt which allows C++ platform-independent development; I also heard it is fast. Now to me, this has a slight similarity to Java. Java requires a JVM so it can run platform-independent. C++ now has something similar. So if C++ can run fast while being platform-independent, I was wondering if there is something similar for Java.

I also cannot believe I am spending time now trying to justify my question to a responder. I asked a question to get answers, not to be challenged by a responder on why I even asked the question in the first place.
Avatar of elepil

ASKER

gurpsbassi, I don't think AngularJS is an alternative. I'd consider it an alternative to other HTML/CSS-based third-party frameworks, but it's not something I'd compare to Swing/SWT which has nothing to do with browsers (unless you're writing a Java applet).

But I had asked you a question about SWT far back which you didn't respond to. You said it runs close to native-speed. Is that a separate GUI library like Swing? I hear Swing/SWT used together so much that I actually thought they were one and the same, until your response made me realize that they're not.
Interested to know, what can you do in Swing that you think you can't do in Angular applications?
Not a trick question, it's just that I've not touched swing in over 10 years.
I read that there is a library for C++ called Qt which allows C++ platform-independent development; I also heard it is fast. Now to me, this has a slight similarity to Java. Java requires a JVM so it can run platform-independent. C++ now has something similar. So if C++ can run fast while being platform-independent

OK. The cause of your problem has now surfaced and the reason for my surprise (at your surprise) which i mentioned:
Well it should be fairly obvious that a cross-platform windowing toolkit running on a virtual machine cannot compete with native windows, other things being equal.
You need to look into the differences and overlaps between plaform independence and cross-platform, and virtual machines.
You will then see that the likes of Qt and GWT have very little in common with Swing/SWT
Avatar of elepil

ASKER

CEHJ, C++ used to compile straight to native code with no "middle man", that's why it was not platform-independent for a long time. But Qt now serves as the "middle man" that allows a C++ program written in the windows environment to run on a Linux or a Mac. It is the JVM that makes Java platform-independent, and I saw Qt as the JVM of C++.

Now here's the important thing I don't think you're hearing from me -- Qt is FAST, that is what I hear from other people. Despite that additional layer, C++ developers don't seem to complain how their GUI applications are running slower. In fact, Qt is a GUI library.

I thought my original post was simple, I usually keep my questions simple. I suggest you read my original question again. Because if you understood it well, we wouldn't be talking about what we're talking about right now.

Let me paraphrase and present my question concisely to you. Do you or don't you know of any library (third-party or otherwise) that can create Java GUI applications that would run faster than Swing/SWT? If not, end of discussion.
Avatar of elepil

ASKER

what can you do in Swing that you think you can't do in Angular applications?

What can C++ do that I can't do in Angular applications? That is essentially what you just asked me.

Swing uses Java, a full-fledged object-oriented language that competes with C++. Swing is the GUI library of Java, just as MFC and Qt are GUI libraries for C++.

Swing has components, like tree components, layout classes that allow you to position your UI elements. AngularJS functionality revolves around one thing -- data binding. How can you compare AngularJS to Swing?
and I saw Qt as the JVM of C++.

Well, quite simply, you're seeing it wrong. You need to understand how Qt works and the important distinctions between it and Java. I can't point you in the real correct direction, as you have not stated your GOAL
To be perfectly honest, because I haven't tried Swing or SWT, so when I see a Java GUI, I really do not know how much is Swing or SWT, or if the latter one is even involved at all.

The easiest example to see an SWT app is to download the Eclipse IDE (https://www.eclipse.org/).
They're the guys who wrote SWT because they weren't happy with the existing offerings, so it gives you a chance to see if you like the feel or not.

You seem familiar with SWT. Is it cross-platform? Also, does it come with a good number of components like a data grid and tree component? And does it support drag and drop for all its components?

I think the answers are yes for all of these (not sure about the drag and drop part - but I assume that's yes).  I wrote an SWT app several years back and it was easy to write and the results looked clean.  Much better than Swing.

Anyway - download Eclipse (it's free) and play around with it.  It's a full featured IDE so it will show you a lot of sample UIs and you can decide for yourself if it's something you'd be happy with or not.

Doug
Avatar of elepil

ASKER

Doug, I already have Eclipse. Are you saying Eclipse was written in SWT? Because Eclipse does not behave like a Swing application, it feels native.
Avatar of elepil

ASKER

CEHJ, let me quote my question for you again:

Are there any alternatives to writing GUI applications in Java other than Swing that's fast and powerful?

Please tell me what in that statement you do not understand. It is clearly stated that I am looking for alternatives to writing GUI applications in Java other than Swing that's fast and powerful.

My goal is clearly to write GUI applications in Java. How else can I spell this out for you?
ASKER CERTIFIED SOLUTION
Avatar of dpearson
dpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Eclipse does not behave like a Swing application
Oops - and yes this is absolutely correct.  Swing and SWT have nothing in common (except both written in Java).

They're are at 100% opposite ends of the spectrum for how to write a GUI library.

Doug
Avatar of elepil

ASKER

Doug, I don't believe it! I've been using Eclipse for years and did not know it was written in SWT! I thought it was written in C++ or some other language.

I'm truly delighted (albeit late), and I believe this is what I'm looking for! Eclipse not only has a tree component (evidenced by their Package Explorer pane (among others), a data grid (as evidenced in the Problems pane), and supports drag and drop even in the editor where you can select a word and drag/drop it somewhere in the editor. Truly impressive!

I had been contemplating on leaving Java for C++ because I felt there was no good way to create a decent standalone desktop GUI application. At least I now know I should not leave Java because I can make decent GUI desktop applications, although I probably won't be able to access a lot of cool API libraries like DirectX10 to make games.

Thank you for your help!
Thank you for your help!

You're very welcome.  Glad you see a path to staying with Java - I think going back to C++ would be hard :)

Doug
Avatar of elepil

ASKER

You know what's weird though, Doug? Amazon.com's latest book on SWT dates back to 2005. I don't know why nobody wrote books for it anymore after that. It gives me the impression that maybe development on SWT by Eclipse or IBM halted many years ago. Oh well, I'll continue to look into it.
My goal is clearly to write GUI applications in Java.
Computers are machines created to solve 'business problems', so no, that's not your goal.

Any perceived (i have tried to use both Netbeans and Eclipse on netbooks and i can assure you that both were equally unusable there, though at least the former is for Java development) performance enhancement achieved by using SWT is probably cheaper to achieve by buying better hardware as soon as you factor in the productivity losses you could quite likely get by using a platform that is much less used and supported.
Swing has components, like tree components, layout classes that allow you to position your UI elements. AngularJS functionality revolves around one thing -- data binding. How can you compare AngularJS to Swing?

Yes swing has all those. And you can do all that stuff with better components in a web application.
AngularJS with d3.js for data visulisation (whether it be trees, pie charts, 3d graphs etc) works really well.
Javascript has come a long way too. These days object oriented javascript is pretty common.

There are so many componentsout there for AngularJS e.g.