When developers use Java Swing, they’re able to write applications with graphical user interfaces (GUIs) that have the same look and feel as the platform they’re designed to run on.
For example, what if’ you’re writing an application that will run on the Windows platform? Using Swing, you might design a user interface element, like a menu, to look like those found in Windows.
But that’s not its main attraction. Developers who use Swing say that it also possesses regular Java cross-platform compatibility. This allows your programmers to write applications using Swing that can be deployed in multiple environments without having to rewrite code.
Here’s a brief look at a few impressions of Swing, and what it could offer you:
When Swing, which is part of the Java Foundation Classes, debuted several years ago, one of the main reasons developers began using it was because it allowed them to write programs that could mimic items on the user's operating system. Objects like scroll bars and menus could be made to look like a part of a specific platform, said Todd Sundsted, a Java technology consultant with ComFrame in Birmingham, AL.
“I think the first reason they used it was for acceptance,” Sundsted said. “People could build applications, and someone could actually use those on Windows, and it would look like a native Windows application.”
There are also “pluggable” tool kits to customize the look of applications. Instead of treating it as a monolithic chunk, where look, feel, and functionality are interwoven, Swing allows them to be separated into two pieces.
“What you’ve got is this back-end model that embodies all of its functionality,” Sundsted said. “It says ‘When a button is pressed, do this,’ and then you can plug a kind of overlay with the [right] look and feel into that.”
“So there’s this view layer that shows how things look, and on the back end there’s this model layer that models its functionality.”
Does Swing help you in ways we’ve described here? Does it have any drawbacks? Post a comment below, or send us an e-mail.
Developing in Swing time
Tim Endres, who wrote jCVS as well as other open-source software in Java, said that the amount of time it takes to write applications in Java Swing is significantly less than doing the same thing in C++, for example. As an engineer who runs his own development company, ICE Engineering, Inc., Endres knows the importance of having an application developed quickly.
“Companies that are moving towards Swing and Java tend to be implementing internal applications,” Endres said. “They want them rapidly deployed, and they want them maintainable.
Young engineers who are just coming into such an environment, for example, would find that putting together applications would “probably require about half the time to come up to speed on Java Swing as opposed to C++,” Endres said.
While consulting with a trading firm, Endres found that any applications that took more than three months to deploy were “useless.” With Swing, he could get the applications up and running quickly.
“After three months, the trading opportunity disappears,” he said. “Someone [would] come in and say, ‘Well, it [takes] a year and a half to develop and then six months more to make it solid,’ and we would just [have to] pitch that project.”
More on Swing
Some of the most comprehensive information on Swing can be found at the Java.sun Web site . Here are two links to classes on Swing:
You can also find information about Java and Swing at jGuru.com.
There’s no reason not to get exactly what you want from TechRepublic. By becoming a member of the ManagerRepublic’s Virtual Advisory Board, you can help guideour Web site by giving us your opinions onthe topics and features you need as an elite member of the IT manager community.Member responsibilities include:
- Advising TechRepublic on topics of interest
- Evaluating new features
- Building the community to answer the concerns that you have