You Got What It Takes
If you can paint it, you can have it
One of the most beloved aspects of Swing is its infinite customizability. When presenting a JavaOne session on our Swing book, Josh Marinacci and I stuck to the catch-phrase "if you can paint it, you can have it." Actually, that's half the story -- the other half is "if you can model it, you can have it." Still, the point remains: if you can model some behavior with code, and use the various AWT, Swing, Java2D or even JOGL API's to put pixels into a
Graphics2D, then you can create more or less anything.
It takes some prodding to get people past the built-in suite of Swing components. There's an "aha" moment when the young Swing developer figures out that while there's no canned tree-table component, a
JTree can be wired to a
JTable in various simple ways, using selection event listeners in the tree to drive changes in the table model. For the more ambitious, there's always Aerith as an extreme example of what's possible.
To get you on the road to customized Swing components, Substance creator Kirill Grouchnikov offers Feature Article today on
How to Write a Custom Swing Component. By way of example, he takes a new component concept introduced by Windows Vista and shows how to use Swing -- and in some cases re-use what it already gives you -- to achieve the same thing in Java:
This article will illustrate the process of creating a custom
component that is based on the new view slider from Microsoft
Windows Vista OS Explorer (see Figure 1). While this component
looks very much like a slider embedded in a pop-up menu, it has new
features that are not available on a regular JSlider. First, it has control points that have associated icons and labels.
In addition, while some ranges are contiguous (like Small Icons-Medium Icons) and allow continuous resizing of the file
icons, other ranges are discrete (like Tiles-Details).
When the value is in one of these ranges, the slider thumb can be
only at control points, and not inside the range.
Have a look, open your mind to what's possible, and go have some fun with Swing.
There's a remarkable accolade to note in Java Today.
The Canadian Broadcasting Corporation reports that James Gosling has been awarded Canada's highest civilian honor, the Order of Canada. The Order of Canada recognizes outstanding lifetime achievement and contributions to society and the country by Canadians from all walks of life. Gosling is one of 29 Canadians named Officers of the Order of Canada and will receive his insignia later in 2007.
Milestone 7 of NetBeans 6.0 (Dev) is now available for download. There is also an alternative way of installing M7 -- using NBI , the new NetBeans installation concept. M7 via NBI is available from the NBI page. Milestone 7 comes with many new features and improvements, including
Java Web Start support for J2SE Projects,
expression stepping in Debugger,
JBoss 5 support,
local history and Subversion properties editor, and more.
DZone blogger Daniel Spiewak asks Does Swing Need Saving?
"There's been some discussion lately regarding various scripting languages and if they are (or aren't) the salvation for the "dying" Swing API (here, here and here). However, all of these blog entries assume one critical fact: Swing is dead or at least dying. I call that assumption into question.
In today's Weblogs, StuartÂ Marks asks you to Keep Bugging Us!
"It's very important for community members to file bugs in Issue Tracker. This lets us know what problems you've run into. Some of them might be more important than bugs in our internal database, but we won't find out about them unless you tell us."
DanilaÂ Sinopalnikov explains the
Motivation for the component model:
"Component model architecture of the phoneME Feature software as an approach to cope with diversity of mobile platforms' capabilities and features."
Finally, ElieÂ Levy spells out the case for
Why Java is going to succeed in the client side.
"When Sun Microsystems released Java back in 1995, the big promise was that it was going to bring profound changes in the way we interact with Web applications. The amazing Applets were going to allow us to write multiplatform rich client applications deployed over the web, that would lead to a reduction of total cost of ownership."
Michele Puccini takes a peek into the source in today's Forums, writing
java2d Compositing -> OpenGL fragment shaders:
"After bouncing my head for some time over OpenGL, alpha compositing, accumulated and premultiplied alpha I decided (curiosity) to take a look at the j2se6 source code just to see what happens behind the scenes. All I discovered (surprise ?) is that the OpenGL codepath of java2d has to deal with premultiplied alpha pixels. That's probably because the Porter and Duff compositing rules "work better" with premultiplied data. But premultiplying and unpremultiplying is done in software loops, so this generates some overhead, expecially when using java2d for creating offscreen graphics with unpremultiplied images. So I decided to implement my very first OpenGL fragment shader that does a SRC_OVER composite on unpremultiplied data. I'm a true beginner, so please forgive me."
Ryan wants to know:
Is there a vendor independent way of accessing EJBs from a standalone client?
"I'm working at setting up an application client and am having some difficulty accessing EJBs on the server. I'm running my client using an application client container and am trying it out on a few different application servers. However, I'm having difficulty finding a way to lookup EJBs in a vendor independent manner. [...] At first I thought I could use application-client.xml to name each EJB and have the container(s) take care of the mapping, but I haven't had any luck with this approach."
Finally, David Grace talks about how to get and build source in the thread
RE: source code for 1.5.
"I had no problems downloading the source on Windows, and I have never used CVS before. I have now used both Netbeans and WinCVS to download source. It seems to be the same procedure for all java.net projects. The CVS command is :pserver:firstname.lastname@example.org:/cvs, and then you give your password. With Netbeans you then click the browse button next to the module textfield, then navigate to the java.net project you are interested in, in this case probably j3d-core. Then you just click the finish button and it downloads everything for you."
Current and upcoming Java
- February 21-23 - 2007 Nonprofit Software Development Summit
- March 2-4 - Greater Wisconsin Software Symposium 2007
- March 6-9 - Java Posse Roundup 2007
- March 8-9 - Desktop Matters 2007
- March 9-11 - New England Software Symposium 2007: Spring Edition
- March 16-18 - Gateway Software Symposium 2007
- MarchÂ 21-23 - TheServerSide Java Symposium 2007
- MarchÂ 23-25 - Greater Nebraska Software Symposium 2007
- May 8-11 - JavaOne 2007
- June 24-28 - Jazoon'07
Registered users can submit event listings for the
href="http://www.java.net/events">java.net Events Page using our
href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
Archives and Subscriptions: This blog is delivered weekdays as
Today RSS feed. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.
If you can paint it, you can have it