4

What is the best approach for making GUI applications for windows with Java?

Is it AWT and Swing? Or is it outdated?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Arun Abraham
  • 4,011
  • 14
  • 54
  • 75
  • 1
    possible duplicate of [Java Desktop application: SWT vs. Swing](http://stackoverflow.com/questions/2306190/java-desktop-application-swt-vs-swing), which has a good comparison between the two. – Andy Thomas Apr 23 '12 at 14:26
  • if its windows only then you could also look at WPF with c# – nikhil Apr 23 '12 at 15:32

4 Answers4

6

If you are starting from scratch and don't have any experience one way or another I suggest looking into JavaFX. It is Oracle's declarative user interface similar to XAML and Flex. I believe it will eventually surpass AWT, Swing and SWT.

While Swing may be common when using Java, more often than not it leads to slow and bulky user experiences. I cannot suggest using Swing.

Why JavaFX

  • The user interface is declarative; you don't have to write Java code. This allows for some really great user interface builders to be constructed, because it can process the UI without having to compile or process Java.
  • The user interface is easily separated from business logic, allowing for separation of concerns and paradigms such as MVVM, MVC, etc.
  • Hardware acceleration support.
  • Transition effects between controls. Something that would take substantial amount of code in Swing.

Download page:

JavaFX and Scene Builder Developer Preview

I realize OS X and Linux are still in the development preview stage, but I'd still pick that over using Swing.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Andrew T Finnell
  • 13,417
  • 3
  • 33
  • 49
  • It looks like JavaFX is - currently - Windows exclusive. Is that correct? Anyone know of a porting timetable? Could use something like that for HP-UX... – Mike Adler Apr 23 '12 at 14:21
  • @MikeAdler They have Mac OS X and Linux Dev Preview. http://www.oracle.com/technetwork/java/javafx/overview/roadmap-1446331.html I believe the OS X is pretty solid, the Linux one will be a few more months before GA. – Andrew T Finnell Apr 23 '12 at 14:30
  • :) Guess this is what i was looking for... I did not want to use Visual studio.. And swing was looking vintage to me... – Arun Abraham Apr 25 '12 at 06:53
  • @Andrew Finnell: Can we develop JavaFX applications with Eclipse ? Guess i saw in the website that we can use only Netbeans.. – Arun Abraham Apr 25 '12 at 10:06
  • I am not sure how they can limit you to netbeans. Its an SDK. Its possible all the designer tools only work in NetBeans. – Andrew T Finnell Apr 25 '12 at 19:44
2

AWT is rarely used. Most GUI development is done in Swing these days. If you're so inclined, there are a couple halfway decent GUI-Builders for Swing out there.

Edit: Honestly, I should have said 'Pure AWT is rarely used'. It is, after all, the basis for Swing.

Mike Adler
  • 1,199
  • 9
  • 24
2

The most common modern GUI toolkits for Java are Swing and SWT. Swing is included in the standard JDK, and is less hassle to deal with. If you just want to build Java GUIs fast (à la Visual Basic), try the Eclipse IDE with WindowBuilder, or the NetBeans IDE.

rob
  • 6,147
  • 2
  • 37
  • 56
0

Swing is the way to go, as it is the newer version that fixed AWT's weaknesses; and there are many great tutorials, such as here.

See here also - Oracle Swing tutorial.

Caffeinated
  • 11,982
  • 40
  • 122
  • 216