Skip to main content

Suddenly I See

Posted by editor on December 12, 2007 at 8:11 AM PST

Java2D gets a scene graph

So, why are we making a big deal about scene graphs today, with both a Java Today and a Weblogs item? Well -- bias alert -- I just think they're really handy. With all the complaints about Swing's complexity (wasn't it just last week that we had a forum question about repaint() versus revalidate()?), it's nice to move further up the stack and give the application developer the ability to say "OK, take this image, make it this large, put it here, and make it the top of the z-order stack. And I don't want to have to deal with it again."

A consistent scene graph across multiple applications may even allow for higher level abstractions. How about if we just define the graphics and UI with markup? With a good scene graph, the mapping of markup elements to graph nodes can be straightforward. I'm thinking of SMIL and SVG and their relations, but I'm sure there are even better examples.

But enough generalizations. Let's get to the news.

The Java Today section starts off by linking to the new Scene Graph project from SwingLabs, which supports JavaFX by providing a scene graph at runtime. By their definition, "a scene graph is a hierarchical representation of graphical objects in a scene. Scene graphs can handle input and they can be rendered, so Swing is an example of a simple scene graph. JavaFX Script defines a more general scene graph model, one that supports effects, arbitrary transforms, and animation. The new com.sun.scenario package provides the runtime support needed by JavaFX Script and it's a useful library for Java applications as well."

Josh Marinacci points out the value of this in his weblog Our new Java Scene Graph is open sourced:

A scene graph saves you the headache of caching, dealing with repaints, worrying about clipping rectangles, and many other annoying details of writing graphics code. It lets you focus on what your code should do, not how it does it. This makes writing graphically rich applications much easier. The scene graph also has built in support for filters like blurs, glows, and shadows. And it works seamlessly with Swing components.

He also explains the specific value of this implementation:

Java has needed a scene graph for a while. There have been several open source ones but not of them were terribly fast, and none of the could take advantage of pipeline hooks for hardware acceleration. Project Scene Graph, on the other hand, is built by the guys who work on Java2D, and we have the potential for all sorts of great acceleration (think pixel shaders). Since this scene graph supports the new JavaFX runtime, and my job is writing tools for JavaFX, I'm happy that it will be as fast as possible.

Josh has more in his blog, introducing both the ideas of scene graphs, and the importance of this particular project, not the least of which is the fact that it is being open-sourced from the start. So, if you're graphically-minded, do take a look.

And no, this isn't actually his big announcement. That's later in the week.

Also in Java Today,
a recent Core Java Tech Tip by John Zukowski looks at Using Callable to Return Results From Runnables. He notes that while "the Runnable interface has been around since the beginning of time for the Java platform," it doesn't provide a straightforward way of getting back a value from the threaded run() method. The Tech Tip shows you how to use the Callable interface, introduced in J2SE 5.0. "Instead of having a run() method, the Callable interface offers a call() method, which can return an Object or, more specifically, any type that is introduced in [a] genericized form."

Sun has submitted JSR-322, Java EE Connector Architecture 1.6, to the JCP for consideration. "The purpose of the Java EE Connector Architecture 1.6 specification is to address areas in J2EE Connector Architecture 1.5 where further support has been requested by the Connector expert group and the public." The new spec intends to offer a generic inflow context, make general improvements to the 1.5 spec (possibly including quality of services, failure handling, message batching, and more), and developing helper classes to improve ease-of-development. Expert Group balloting for this JSR ends on December 17.

Further down in today's Weblogs,
Masoud Kalali adds GlassFish to an app server shootout, in Four open source Java application servers compared: "a small addition to the JavaWorld article JBoss, Geronimo, or Tomcat?, I add a Glassfish column and some related description here to extend the comparison."

Finally, Arun Gupta offers a
GlassFish Book Review.
"A book on GlassFish: Java EE 5 Development using GlassFish Application Server by David Heffelfinger, was released last month. The publisher sent a courtesy copy for review, thank you for that. Here are some of the points that I'd like to highlight."

An important announcement tops today's Forums, as Alexis Moussine-Pouchkine directs your attention to
"We're extending the Write a GlassFish Update Center Plugin contest for another week. If you haven't heard about this before, this is your chance to make your favorite framework library or application available through the Update Center to GlassFish users and of course to win one of three prizes. You do not need to be at the JavaPolis conference to compete."

Speaking of conferences, Terrence Barr has encouraging news about video feeds of sessions for those who can't make it to next month's ME conference, in
Re: Remote participation of ME Developer Days.
"Thanks for checking back. As Roger says we're still working on it. Currently, the most likely approach will be video feeds out to ustream also has the capability of chat attached to the video channel so that would allow remote participants to ask questions as well. If you have any questions/comments/suggestions please let us know."

In a new forum provided for announcements of conferences, marshdm points out that
CodeMash 2008 is coming up.
"Join Java, Ruby, .NET, Python, and PHP developers at an indoor water park in Sandusky, OH from the evening of January 9, 2008 through January 11, 2008. We have a great lineup of talks scheduled. Dick Wall, of the Java Posse, will present talks on both Guice and Android. Scott Hanselman and Brian Goetz will keynote. Bruce Eckel is managing the Open Spaces component. Leah Culver (Pownce) will speak, as will Andrew Glover (co-author of Groovy in Action) and Neal Ford."

Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

Java2D gets a scene graph