Skip to main content

Parts of Your World

Posted by editor on March 23, 2006 at 6:21 AM PST

An audacious splitter for Swing layouts

It's enough to tough it out as a Swing programmer and use the powerful but verbose and obtuse GridBagLayout... the killer is when you've split the main window seven ways from Sunday and the boss comes back and says:

Can we make that resizable?

And inside your mind, a thousand neurons wired for thinking in Swing say:


Swing's support for resizability is... let's say "modest". The default component, JSplitPane, allows for a two-way split component -- i.e., a component with two children, arranged verically or horizontally, with a draggable separator between them. If you have, say, four or five components that potentially need to be resized, you're forced use nested layouts of JSplitPanes, and even then, it may not be possible to achieve an intuitive, pleasing arrangement.

What's needed, obviously, is support for complex layouts and multiple splits, designed to co-exist.

In today's Feature Article, Hans Muller comes through with just such a beast, the MultiSplitPane, which allows for intricate split layouts:

MultiSplitPane differs from components with similar capabilities in that complex dynamic layouts can be defined without nesting or composition. All of the children managed by a MultiSplitPane are arranged in their rows and columns (and rows within columns and columns within rows) end up separated by divider gaps, but not by extra layout-managing containers. MultiSplitPane's layout class, MultiSplitLayout, is also a little unusual in that it exposes a model of the complete layout. Most layout managers have a complex internal model that represents the layout, and some, like GridBagLayout, even support ad-hoc access to the model. MultiSplitPane provides explicit access to the complete layout model, in the same way that Swing components provide access to their data models. The motivation for this wasn't just flexibility, or separation of concerns. A single explicit layout model means that a more elaborate layout management system, like a docking framework, can be layered on top of MultiSplitPane without requiring burdensome assumptions about the type or structure of the component hierarchy.

This is a remakably slick piece of work, supporting persistence (through XML bean persistence) of a user-tweaked layout, and a syntax for laying out the contents of the MultiSplitPane with a formatting String rather than a bunch of add...() method calls.

Tom Ball looks at A Little Language in today's Weblogs.
"The rule language uses the Little Language design pattern to make accessing a subset of Jackpot's transformation facility easier. Tom discusses the trade-offs between power and ease-of-use in its design."

"It's Alive", Dan Hushon writes:
"With the launch of Sun Grid, Sun is attempting to change the paradigm to one in which independent software developers can have the same resources available to them as the best funded of companies."

How do I map xs:date to java.util.Date? Kohsuke Kawaguchi answers the question in his latest blog.

In Also in
Java Today
Bill Venners updates the discussion about James Gosling's recent comments about Java vis-a-vis other languages in Java and Other Languages: What Gosling Really Said. "There has been a lot of discussion around the net, including at Artima, about Gosling's recent comments concerning PHP, Ruby, and other languages. But until now, the full transcript and context wasn't available. Last week we posted a short news item pointing to some comments made by James Gosling, and some questions about the accuracy of the quote came up in the forum discussion. James Gosling himself indicated that, "The quote is accurate, but incomplete and missing context." In this news item I give the full transcript of his comments, which recently became available in video form."

Profiling is a technique for measuring where software programs consume resources, including CPU time and memory. In Build your own profiling tool, software architect Andrew Wilcox explains the benefits of profiling and some current profiling options and their shortcomings. He then shows you how to use the new Java 5 agent interface and simple aspect-oriented programming techniques to build your own profiler.

In Projects and
Mark Reinhold's blog Mustang Maintenance Review 1 discusses the recently-posted href="">Maintenance Review for the
Mustang (Java SE 6)
release. "This review describes the details of all the changes and additions made to the Java SE platform specification in Mustang that aren't themselves specified by their own JSRs... The maintenance review also contains countless small corrections to the platform specification."

The article Meet the Six New Star Spec Leads introduces new members of the JCP's honor roll: Danny Coward, Pierre Gauthier, Janna Majakangas, Eamonn McManus, Antti Rantalahti, and Bill Shannon. "Exceptional spec lead performance gets noticed by the community as a key ingredient for an effective and smooth Java Specification Requests (JSR) development process."

In today's Forums,
oholo asks about
java annotations and xsd-files to generate a web service:
"I am trying to find out if it is possible to "generate" a web service starting with the following things: * an annotated java source file (JSR-181 type annotations but possibly others as well? JAXB-things?), * xsd-files: one xsd-file for each of the parameter/return/exception-types needed, * and of course java source files for the types mentioned above."

sgregory is interested in
Calling out of the JDIC browser into the Java application
We use the JDIC browser to implement an HTML editor. One of the problems that we have is that there is no way to call from the browser back into the Java application (for instance, to update the font face drop-down, the the bold toggle button). Are there any plans for implementing call backs of this kind? Native Win32 applications can do this, and it makes the Java version of our product very sluggish as we have resorted to polling with executeScript to see what we need to change. —

In today's
News Headlines

Registered users can submit news items for the href=""> News Page using our
news submission
. All submissions go through an editorial review before being
posted to the site. You can also subscribe to the href=""> News RSS

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.

An audacious splitter for Swing layouts