0

I'm quite new to Java.

I have a tool written in C#, which I want to port to Java.

I use Eclipse, and thought to start off with WindowBuilder.

However, I'm quite confused by the variety of options (GWT, SWT, Swing), and the more I google, the more confused I become.

I need a clean GUI, nothing overly complicated, and I would like to work with the easiest framework, preferably one that is as similiar as possible to C# style.

What can you recommend to me?

sjas
  • 18,644
  • 14
  • 87
  • 92
sara
  • 3,824
  • 9
  • 43
  • 71

5 Answers5

3

I should say the "easiest" (i.e., best-documented, and oldest) framework (of the three) is clearly Swing.

Check out the Oracle Swing tutorials.

There are some things to keep in mind when using Swing (e.g., it's said to be "not thread safe", but see this thread for example), but generally I'd recommend it as the starting point for GUI development in Java.

SWT (Standard Widget Toolkit) had originally been developed for Eclipse, and GWT (Google Web Toolkit) is used for Web apps.

Community
  • 1
  • 1
s.d
  • 4,017
  • 5
  • 35
  • 65
  • 1
    *"it's not thread safe"* Which can easily be 'fixed' (in inverted commas because I don't consider it broken in the first place). I have watched other (native) apps. on Windows suffer the exact same 'GUI freeze' on becoming busy. Try setting your drives to power down on inactivity, it becomes quite apparent when loading documents in many apps. supplied with the OS (or supplied by the same company). – Andrew Thompson Apr 04 '12 at 09:09
  • 1
    @AndrewThompson: Sure, Swing's neither "broken", nor is thread safety an issue which cannot be 'fixed' (d'accord re single quotes). I just wanted to mention it because any new user of Swing is likely to come across this and consequentially might be afraid that s/he bet on the wrong horse. Will edit the answer to reflect this in a less threatening way. – s.d Apr 04 '12 at 09:39
  • Nice edit (and salient warning)... :) – Andrew Thompson Apr 04 '12 at 09:45
  • 1
    The only reason Java UIs "lock up" is because so many developers lazily or incorrectly neglect to use worker threads for long running tasks. Stop doing stupid stuff within the Event Dispatch Thread and you won't have problems. –  Jun 01 '13 at 20:26
1

Try Java Qt, its pretty awesome with C++

VMAtm
  • 27,943
  • 17
  • 79
  • 125
Aadi Droid
  • 1,689
  • 4
  • 22
  • 46
  • 2
    Check the discussion here to help further http://stackoverflow.com/questions/422956/java-swing-or-java-qt – Aadi Droid Apr 04 '12 at 08:47
0

I think swing is quite easy, so I would start with swing

QI3it
  • 181
  • 7
0

The best way to start if you come from C# is to install Netbeans IDE. It has all kinds of Wizard for creating new Forms and you have a high quality visual editor that just looks like the one in Visual Studio.

After that you can edit the "code behind" to get use to manipulate components programatically. I suppose Eclipse can do it too, but to my opinion, Netbeans is very stable and comes with everything working by default, no time lost with configuration or plugin installation...

Also if you need a sophisticated docking windows framework, it is also integrated inside Netbeans and you've got a wizard to build a "Rich Client Plateform Application":

It relies, just as in Eclipse RCP, on the Netbeans Platform kernel with IDE Plugin removed. And it has interesting functionalities such as generating a cross platform installer and having plugins inside your app...

Good luck,

Renaud

Renaud
  • 1,833
  • 19
  • 20
0

I've used Swing and GWT pretty extensively. As mentioned by others, Swing is a good choice for a standalone Java app. I can't offer an opinion on Swing vs. SWT because I've never used SWT. But how many applications are standalone these days? Not too many.

If you want your application to be accessed from a browser, you probably want to use a javascript based UI. There are many javascript-based UI frameworks, e.g. YUI, Dojo, Prototype, JQuery, etc. Which to use? If you like programming in Javascript (not a simple language to master, btw) you may want to use one or more of these frameworks. However, if you are new to Java and don't know javascript, GWT may be very good choice, as it generally eliminates the need to know javascript (you write all your code in Java and the compiler generates highly optimized javascript for you, and almost always smooths out all the differences between browsers -- this is a big deal). I've used GWT for over a year now, and I highly recommend it. It can be used with Google app engine or with any other server-side technology. One question I would have is if GWT can be used effectively for a standalone app. I would imagine there are ways to do this, but I haven't researched it. If so, I would tend towards using GWT for a standalone app, as well, because then your code could be reused for a web-based interface, should that standalone app end up becoming web-enabled.

ptflix
  • 83
  • 8