Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

SWT, XML Put True Cross-platform GUIs Within Reach

The reality of a single cross-language, cross-platform GUI interface programming model is in sight, based on an XML description language supported by fast native runtimes. Will Mozilla, Eclipse, or someone else step in and complete the last mile that gives all developers a common way to design and program fast cross-platform user interfaces?


advertisement
he Java world has a new toy called SWT (the Standard Widget Toolkit), created by IBM and integrated with the Eclipse development environment. SWT is a platform-specific runtime that exposes "widget" objects such as text boxes, scrollbars, and other familiar GUI controls to Java developers, but uses JNI to make native code calls to create and interact with those controls. Using SWT, Java developers can build responsive GUI applications that are essentially indistinguishable from native platform GUIs.

That's not to say that SWT applications aren't cross-platform; they are (mostly). There are SWT implementations for Windows (Win32), Windows CE, Motif (Linux, AIX, HP/UX, Solaris), GTK (Linux), and several others. The SWT runtime changes when you run your application on these different operating systems, but as long as your application code uses standard widgets it can run unchanged. (Not all implementations are feature-complete; you can check the current status at Eclipse.org.) Sure, some platforms have widgets and capabilities that others don't have, but all the implementations include a core set of widgets—and programming to the core set from Java is identical across all the platforms.

Some Java developers—and Sun itself—object to SWT because it ties applications to platform-specific code, thus breaking the cross-platform nature of applications written without such dependencies-—such as those written with Swing. But many developers eschew the purist attitude and are using SWT anyway because it improves the performance of Java applications, making them more competitive with applications targeted to specific platforms.



The developers on the Mozilla project, faced with a similar problem—how to create a cross-platform browser—came up with a different type of solution, called XUL (XML-based User Interface Language), which uses an XML-formatted language to define a description of the interface objects. That's the first big difference between XUL and SWT. While both define "widgets," the SWT implementation includes the code to create and activate the widgets, while XUL simply describes them. In Mozilla, you can control the interface elements with C, C++, Python, or JavaScript, and you can control the appearance or style of the widgets using CSS (Cascading Style Sheets).

So far, SWT implementations target desktop applications, while Mozilla's XUL currently targets browser-based applications. But there's no real reason why they have to remain in those niches; both are ways to describe and activate controls. It doesn't really matter whether those controls run in a browser or in a desktop application.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap