Trolltech pours on the Java dev goodness

Iconic GUI toolkit vendor brings its rich toolkit recipe to Java

The world of Java depends on two established GUI toolkits: Swing and SWT (standard widget toolkit). Both software packages provide the widgets, controls, menus, and user interface components in most Java applications today. Swing, which Sun bundles with Java, first shipped with Java 1.2 in 1998. SWT, developed by IBM, must be downloaded separately. Its most famous application is the Eclipse development environment.

Both toolkits have their strengths and weaknesses; Swing is fast and comprehensive, but tedious to program for. SWT is easy to program for, but offers only a subset of Swing's functionality. One complaint that is equally valid for both is that they receive insufficient attention from their respective companies. It's clear that keeping the GUI functionality advancing is not a first-order priority for the developers at either Sun or IBM.

Thus, it was with considerable interest that I examined a third toolkit, Jambi from Trolltech. The company makes arguably the finest C++ GUI library today and is wholly focused on GUI development. I previously reviewed the C++ library, known as Qt, in 2005 and found every aspect of its implementation to be superior. Jambi shows a lot of promise, but it has some rough edges that were notably absent in its forebear.

Brewing Java

Jambi ships as a single Java library, or JAR (Java Archive) file, plus a handful of tools, including an interface layout and design tool, and an Eclipse plug-in. Trolltech uses its vaunted Qt C++ library as the GUI engine and puts Java wrappers around it. This approach uses the JNI (Java Native Interface) to call the necessary functions from Java. This design, which is also used by SWT, works well. It employees the native widgets whenever they exists, which guarantees an accurate look and feel for applications. For example, Qt Designer (pictured here) provides a rich palette for designing screens and dialog boxes interactively, and Qt Jambi (pictured below) delivers an array of rich visual capabilities. The problem with this approach is it can lead to lesser performance as actions are moved through the Java/native barrier. In actual practice, however, I did not notice any such slowdown.

The Jambi widgets tend to be smarter than their pure Java counterparts: The resizing behavior can be injected into a container rather than being specified for each and every widget on the screen. Defaults are more intelligent as well. For example, all text fields are scrollable by default. In essence, it's as if someone took Swing or SWT and redesigned them from scratch to be more intelligent and easier to use. The clean design, of course, is the product of Trolltech's years of developing GUI tools and having a company entirely focused on that one mission.

Because of this narrow focus, Jambi manages to deliver exceptional ease of development. It's simple to program, requiring only a short learning curve. After working with it for a few days, you come to anticipate the names of objects and methods you're likely to use -- a tribute to its consistent and clean API design.

This impressive ease of use greatly exceeds that of SWT, and in several key areas, it trumps Swing as well. Graphics functions support native graphics or OpenGL. Text can be true rich with multiple typefaces in different colors and sizes displayed simultaneously. The complement of widgets or controls is a superset of both Java toolkits, and it includes numerous complex and high-level items.

Jambi also delivers many functions that are not specifically related to graphics or user interfaces. One example is a wrapper class for network sockets. The high-level and low-level functions Jambi provides make simple work of writing to an HTTP server, which is included as a demo application. Additional areas of functionality include collections, internationalization, thread and process management, as well as property and resource management. That's a considerable amount of utility delivered in clean, intelligent library.

High marks for C++ developers

My most pressing complaint is that the package lacks a Java feel. You cannot escape knowing it is a ported C++ library. The Jambi documents frequently refer to C++ concepts and often link to C++ documentation, even when explaining a Java concept. This is fine for existing Qt users who see in Jambi a port to Java, but it is hardly what a Java developer would expect or even care to deal with.

In other areas, Jambi has some requirements that a Java developer needs to know up front. For example, threaded applications that use Jambi for the GUI must also use Jambi's low-level thread functions throughout. Using Java's own thread functions will lead to errors. In other cases, these unexpected items are directly beneficial -- such as Jambi's elegant way of solving some classpath difficulties, which are one of the known weak points of Java desktop applications. However, this shortcut requires Java developers to step out of the normal way of doing things and they will frequently feel caught off guard. Unfortunately, should difficulties arise in this regard, tech support is based in Europe and provides assistance only via e-mail. For U.S. developers, turn-around on support requests can be slower than desirable.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Andrew Binstock

InfoWorld
Show Comments

Cool Tech

Bang and Olufsen Beosound Stage - Dolby Atmos Soundbar

Learn more >

Toys for Boys

Nakamichi Delta 100 3-Way Hi Fi Speaker System

Learn more >

Sony WF-1000XM3 Wireless Noise Cancelling Headphones

Learn more >

ASUS ROG, ACRONYM partner for Special Edition Zephyrus G14

Learn more >

Family Friendly

Mario Kart Live: Home Circuit for Nintendo Switch

Learn more >

Philips Sonicare Diamond Clean 9000 Toothbrush

Learn more >

Stocking Stuffer

SunnyBunny Snowflakes 20 LED Solar Powered Fairy String

Learn more >

Teac 7 inch Swivel Screen Portable DVD Player

Learn more >

Christmas Gift Guide

Click for more ›

Brand Post

Shining a light on creativity

MSI has long pushed the boundaries of invention with its ever-evolving range of laptops but it has now pulled off a world first with the new MSI Creative 17.

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Tom Pope

Dynabook Portégé X30L-G

Ultimately this laptop has achieved everything I would hope for in a laptop for work, while fitting that into a form factor and weight that is remarkable.

Tom Sellers

MSI P65

This smart laptop was enjoyable to use and great to work on – creating content was super simple.

Lolita Wang

MSI GT76

It really doesn’t get more “gaming laptop” than this.

Jack Jeffries

MSI GS75

As the Maserati or BMW of laptops, it would fit perfectly in the hands of a professional needing firepower under the hood, sophistication and class on the surface, and gaming prowess (sports mode if you will) in between.

Taylor Carr

MSI PS63

The MSI PS63 is an amazing laptop and I would definitely consider buying one in the future.

Christopher Low

Brother RJ-4230B

This small mobile printer is exactly what I need for invoicing and other jobs such as sending fellow tradesman details or step-by-step instructions that I can easily print off from my phone or the Web.

Featured Content

Product Launch Showcase

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?