转篇文章:
UI Design with java and XML Toolkits
Contributed by Dan Wellman
2006−09−13
With GoToMyPC®, the award−winning remote−access solution, you’ll never have to take files on the road again. GoToMyPC gives you
the power to access your PC from airports, hotels, Internet cafes – anywhere with Web access. Try it FREE.
XML has revolutionized application UI design in recent years. With a cunning blend of XML and script languages such as JavaScript, rich, aesthetically pleasing applications can be quickly constructed with ease. We've looked at Widgets and XUL as two examples of this in the past and now, I'm going to take a look at some of the innovative java UI toolkits that
implement XML as an integral mechanism for application II design. Please note, this is the first part of a two−part article. A quick trip to Google shows just how many java XML UI toolkits there are around now. Many of these toolkits are open source, which is great news for developers, and for people that just want to get involved or to learn the basics of
application design. There are also a growing number of full−fledged applications designed to give you an interface of your own in which to design and produce interfaces. The fact that these applications exist at all show that java and XML GUIs are the answer that many developers have been looking for.
In addition to java/XML UI toolkits, other specifications are also being developed to make use of XML in GUI development, like XAML (eXtensible Application Markup Language), a language that defines UI objects in XML and renders them using the WPF (Windows Presentation Foundation), which is the new presentation API in the .Net framework 3.0. So, there are quite a few different UI toolkits you can choose from. Whatever associated technologies you have experience with or want to gain experience in, there is bound to be a toolkit or IDE you can use. Make sure you've
got the latest java Development Kit (JDK) rather than just the standard java Runtime Engine (JRE) before attempting to
use any of the UI toolkits.
It would seem to be the next logical step for people that have comfortably used XUL to create add−ins for Mozilla or
FireFox, or even mini desktop applications. Whereas XUL must mostly run within either browser, Luxor is an embedded
XUL engine that is combined with java to produce rich desktop applications, including the very popular LimeWire
peer−to−peer program. Because specifying the user interface in XUL is so easy, constructing a functional and attractive
interface can be done very quickly −− much quicker, and with greatly simplified code in fact than in writing the whole
application in java.
You can also make use of several of the main attractions of XUL; CSS styling which allows a simple mechanism for
creating a visual theme for your app, and the skinnability that many users desire, as well as the localizational properties of
XUL. JavaScript can be utilized effectively for the simple functions of an interface, but java gives you more power than
Javascript and has been claimed as being easier to learn with a cleaner syntax. JavaScript is also less appropriate outside
of a browser environment.
For those of you that aren't interested in learning java, there is also Luxilla, which is a Luxor development environment
you can use without knowing/coding a single line of java. Luxor is free, open source and released under the GPL. A
Luxor web site does exist, at http://luxor−xul.sourceforge.net/index.html, but don't expect anything more than a very basic
site. There is little real information for anyone wanting to get started with Luxor , and no introductory tutorials that guide
you through the installation process or use.
Luxor comes in the form of an executable .JAR file, much like most of Mozilla/FireFox, which contains the swing class
files used to render the UI objects on screen. Luxor enthusiasm does seem to be at a low ebb at present, the latest
distribution being around 18 months old. I have to admit, in the time I allocated to playing around with each of the java
Dev Articles 01/06/2007 01:38:02 PM
1/3