Question

I have been mucking about with Java swing lately but it's butt ugly! Are most people who write Java GUI's using swing or something else? I would really appreciate a recommendation. I don't want to use a GUI builder because I need to learn how everything works first.

Thanks!

Was it helpful?

Solution

Most people use Swing.

Some use SWT, but you have to dispose object after use. (no auto dispose in Garbage collecting) It give very native look UI.

Some use Qt-Jambi, but then you have to understand some C++ code. Most of them are for interoperating with Qt.

Some ancient code use AWT. Most of them are for legacy reason. I recommend avoid it.

OTHER TIPS

If you don't like the default Swing look'n'feel, you can change it ; many ready-built themes exist. And it is quite possible to build beautiful and ergonomic applications with Swing : take a look at Netbeans or IntelliJ.

But if you definitely want to use another graphic toolkit, you can try SWT. Contrary to Swing that is pure Java, SWT uses native controls as much as possible (those provided by your OS), and emulates the missing ones. It was developed for, and is used by, the Eclipse platform.

I have been mucking about with Java swing lately but it's butt ugly!

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}

Are most people who write Java GUI's using swing

For most things, yes. It's built-in, and doesn't suck that bad for a cross-platform GUI library (which all suck to some extent).

By the way, Swing's Look and Feel can be customized. There are some pretty good LaFs. See here how to change the look and feel.

Check this question for how to change the look and feel and for a list of nice look and feels

SWT is very good. It tries to use native GUI drawing functions wherever possible. An example of application written with SWT is Eclipse IDE.

http://www.eclipse.org/swt/

you can use native look and feel with swing, thus it's less ugly. Personnally, I use swing for my GUIs in java, and I find it quite straight forward and documented.

Here is a link toward swing documentation:

http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

The only thing is ugly in Swing is standart layout manages. They are or too primitive or too complicated. If you really want to write nice gui without gui builders take a look at alternative layout managers. For example Table layout https://tablelayout.dev.java.net/

Look to SWT http://www.eclipse.org/swt/ - Eclipse entirely built on it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top