Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Community

Meet Scott Violet, Architect for the Swing Toolkit Team at Sun Microsystems

 
 
By Janice J. Heiss, October 2006  
Scott Violet Bio: I've been in Sun's Java technology client group for more than eight years. I started out in the OpenStep group and then joined the Java Software group working on the Swing toolkit. I've worked on Java Web Start software, the NetBeans IDE, and the Glow project. I'm currently the Chief client architect for the Swing toolkit team and have been working on the project since long before the Swing 1.0 release. I've been involved with the NetBeans IDE GUI Builder almost since its inception.
 

java.sun.com (JSC): What should developers understand about how they can use advanced Swing and Java 2D technologies to create powerful visual applications?

Violet: The Swing toolkit makes it extremely easy to do custom rendering. You only have to subclass one of the various JComponent subclasses and override paintComponent. That's it! Of course, once you've done that, you need to decide what to render. The key ingredient in rendering is understanding the various Java 2D APIs: java.awt.Graphics2D is critical, but others such as GradientPaint, Kernel, and ConvolveOp are often necessary. I have no idea why Kernel and ConvolveOp are so named, but they make it easy to create great shadow effects.

Here's some code for blurring an image:

float[] kernelData = new float[9];
for (int i = 0; i < kernelData.length; i++)
{
	kernelData[i] = 0.15f;
}
ConvolveOp blur = new ConvolveOp(new Kernel(3, 3, kernelData));
BufferedImage blurryImage = new BufferedImage(w, h, w, h, 
	BufferedImage.TYPE_INT_ARGB); 
blurryImage.createGraphics().drawImage(imageToBlur, blur, 0, 2);
 

The trick is knowing what to do. Once you've seen the code, it's pretty straightforward. The last ingredient is animation. Chet Haase has been working hard on these problems and has created an open-source project called timing framework to make the process easier. We made extensive use of this open-source framework in many of our 2006 JavaOne Conference talks.

Misconceptions About the Swing Toolkit

JSC: What are the biggest misconceptions about Swing technology?

Violet: The Swing toolkit was originally stigmatized for being too slow, but it's not anymore and hasn't been slow for quite some time. Yet the stigma persists. Very large consumer applications built on Swing technology prove that it is an entirely capable toolkit.

Hopefully, widespread consumer applications will dispel this myth once and for all.

JSC: Where do you have the most fun creating visually impressive applications?

Violet: In seeing the expressions on people's faces when I come up with a new effect. A "wow" from one person makes my day!

JSC: Why are stunning effects important?

Violet: Over the last 10 years, computer power has increased exponentially, allowing most applications to make use of striking effects. The bar has been raised, and end users are expecting richer and richer applications.

JSC: What's the hardest part of coding for animations and effects?

Violet: Far and away the hardest part is deciding on the effect. Once you've decided on the effect, the coding usually isn't that hard. In deciding upon effects, I don't have any one particular source of inspiration. Apple, Sony's PSP, Vista, video games -- anything visually powerful is fair game.

JSC: What do you find most valuable about visually appealing graphical user interfaces (GUIs)?

Violet: If I could concoct a recipe for stunning effects, I'm sure I could make a mint. In many ways, stunning effects are like art or fashion. Beauty is in the eye of the beholder: What I find beautiful might not be appealing to others. And what is now stunning will likely be passé in 10 years.

In consumer applications, the best effects are those that don't get in the way of my work flow and that help in some way. For example, photo-viewing applications that animate transitions when adding and removing photos help to remind me what just happened. Rather than jarring jumps, animated transitions are good cues. And they look cool!

Beans Binding

JSC: How might the binding of components based on JavaBeans component architecture (beans) make life easier for developers of Java desktop technology who are writing component wiring, the glue code that connects components to the application model?

Violet: Beans binding is all about simplifying. When writing any desktop application, you need to bind your application model to the user interface (UI). For example, you need to bind a property of a bean to a text field, or the contents of a ResultSet to a JTable.

Wouldn't it be nice if this could be simplified to something like this:

bind(myResultSet, myJTable);

The beans binding expert group for JSR 295 has been formed. We're early in the process and hope to do all of the development and release implementation openly with a public forum.

JSC: What misconceptions do developers have about data binding?

Violet: The biggest misconception is that beans binding is only useful for database applications, which clearly isn't the case. All desktop applications need to bind to components in some way. Thus, beans binding is of use to all developers who use the Swing toolkit.

Instead of focusing on the model and listeners that a particular component exposes, developers can focus on the properties, which leads to a simpler view of the toolkit. You need not know the specifics of the component, just the properties. So rather than adding a DocumentListener to track changes to a JTextComponentwould simply bind to the text property of the JTextComponent.

New Desktop Features of Java Platform, Standard Edition 6

JSC: What should developers of Java desktop technology understand about what's new in Java Platform, Standard Edition 6 (Java SE 6)?

Violet: The Java SE 6 release adds a cornucopia of new desktop-related features. We've added subpixel font rendering and improved our GIMP Toolkit (GTK+) and Windows look and feel. We've added much-requested features such as the splash-screen API, table sorting and filtering, and desktop APIs. Layout is easier with GroupLayout. Drag and drop is no longer a drag. Both the Java Web Start software and the Java Plugin Framework user experience is much improved. The list goes on and on. The complete catalog of major desktop features can be found here.

JSC: What is the future of the Java technology desktop?

Violet: Making developers' lives easier! In addition to beans binding, JSR 296, the Swing Application Framework, will simplify developers' lives.

Have you ever wondered how you should structure your application? Where you should put your resources? How to use actions? How to use threads? JSR 296 will address all of these -- and more. We will be working closely with tool vendors on both JSR 295 and 296 to ensure excellent tool support.

The NetBeans IDE GUI Builder Makes Swing Technology Easier

JSC: Why is the NetBeans IDE GUI Builder important?

Violet: The NetBeans IDE GUI Builder is important because it makes it easy to lay out Swing toolkit components, thereby lowering the bar needed to use the toolkit. Layout managers are a key to the principles of Java technology-based applications. They allow you to position and size components in a platform-neutral way: Write once, run anywhere. The downside is that layout managers are painful and tedious to use and require a level of understanding most developers quite rightly don't have time for. Anyone who has tried to used GridBagLayout knows this firsthand. In planning Java SE 6, we wanted to address layout from the tools perspective. We knew that the layout issue was preventing people from using the Swing toolkit. Thankfully, the NetBeans community was keen on addressing this as well.

Out of this work, the NetBeans IDE GUI Builder, formerly known as Matisse, was born. When designing it, we observed how developers use tools to lay out components. For instance, how did they move components around and position them? Developers do not want to deal with layout managers. Developers want to drag and drop components and position them as they would in a drawing application. It's easy to lay out Swing components with the GUI builder.

JSC: Can you describe the process of writing code?

Violet: It depends upon where I am in the design phase. Sometimes, I write notes on random things. Other times, I'm doing use cases. Other times, I'm researching. And of course, there's writing the actual bits.

JSC: What do you do when you feel stumped?

Violet: Engage the appropriate set of coworkers in a discussion. Usual victims include Hans Muller, Shannon Hickey, and Chet Haase, but anyone in the office is fair game.

JSC: What Java technology class could you not live without?

Violet: Object. Without Object, who would we subclass?

JSC: What's your favorite Java technology book?

Violet: Google.

JSC: Do you have a funny story related to Java technology?

Violet: I can't count how many times I've had on a T-shirt with the Java technology logo and have been asked what coffee I like best.

JSC: Is there an intellectual discipline or fun activity that you feel makes you a better developer?

Violet: I love to code! Doing projects in my spare time helps me stay current with the latest changes to the platform and what's going on in the community.

Advice for Newbies

JSC: What's the next big technology revolution?

Violet: If I could answer that, I'd join the start-up doing it. Users are tired of plain, static web pages and want more. Consequently, I'm sure we'll see a richer web experience. I don't know if we'll get VRML (Virtual Reality Modeling Language) again, but time will tell. I'm also astounded by the popularity of MySpace. Who would have thought...

JSC: What would you say to a student or an engineer new to Java technology?

Violet: This may sound trite: Follow your heart. To be truly successful, you must love what you do. If your heart isn't in it, that will show.

JSC: What do you see as the most important Java API five years from now?

Violet: JSR 295 and 296 should really simplify Swing developers' lives. But they'll be out way before five years. Although I don't know which API will be the most important, I suspect that ease of development will be a common theme running through all future APIs. Developers -- myself included -- are lazy. We prefer APIs and platforms that enable us to get our jobs done quickly and efficiently.

Dream Project

JSC: If you could work on a dream project, what would it be?

Violet: Although I don't play video games as much as I once did, I enjoy them. I've often thought working at a video game company would be a lot of fun. But reading recent reports on overworked video game developers leads me to believe that's probably not a good industry to be in.

I wouldn't have worked on the Swing toolkit for close to 10 years if I didn't love working on GUI toolkits. A GUI toolkit is never done. The demands of developers continually change and evolve, and GUI toolkits must meet new demands or fall by the wayside. For this reason, and more, working on a GUI toolkit is a dream project for me.

JSC: What has been your biggest surprise in working with Java technology?

Violet: I'm amazed at how far Java software has come in so short a time. Just think: Java technology-based applications started out targeted at small devices but are now used throughout the world in mission-critical applications. I don't think anyone anticipated this.

JSC: What recent changes to the platform have made your life easier?

Violet: Generics has made life both easier and harder. Generics really simplifies usage of the collection classes. You get compile time-type safety and arguably easier-to-read code.

On the other hand, using generics in an API is tricky. There are so many edge cases, including lack of runtime information, that I often get frustrated.

See Also

Scott Violet's Blog
The Next Wave of GUIs: Project Matisse and NetBeans IDE 5.0
The Swing Connection
JSR 295: Beans Binding
JSR 296: Swing Application Framework
2006 JavaOne Online Technical Sessions
Meet Shannon Hickey, Technical Lead for the Swing Toolkit Team at Sun Microsystems
Meet Josh Marinacci of the Swing Toolkit Team at Sun Microsystems
Ask the Experts -- Session on Swing

The terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
If you would like a reply to your comment, please submit your email address:
Note: We may not respond to all submitted comments.