Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Nimbus Look-and-Feel: Vector UIs for Java

Nimbus Look-and-Feel: Vector UIs for Java

This item in japanese

In his announcement that the Nimbus Look-and-Feel (LAF) is nearing completion, Jasper Potts described some of the technology behind Nimbus, and provided some screenshots:

All of Nimbus is rendered with 2D vector graphics, there is not one image even for all the icons. This means that the whole of Nimbus is just 56k as a packed jar which is pretty impressive for a whole rich look and feel.

This is technically impressive, but it also has the potential to support a resolution-independent interface suitable for high dot-per-inch (DPI) displays, a topic that has received a lot of attention in recent months.

Although many feel that high-dpi user interfaces are important for upcoming advances in high-resolution displays, Jeff Atwood has argued that increases in monitor DPI statistics have been slow and that claims of a 200-dpi future around the corner may be excessive:

Regardless, it's sobering to consider that the resolution of computer displays has increased by less than a factor of two over the last twenty years. Sure, displays have gotten larger -- much larger -- but actual display resolution in terms of pixels per inch has only gone up by a factor of about 1.6.

Short of some kind of miraculous technological breakthrough, I can't see computer displays reaching 200 DPI in "a few years". It's unlikely we'll even get there in ten years. I'd love to be proven wrong, but all the evidence of history-- not to mention typical consumer "bigger is better" behavior-- is overwhelming.

The Nimbus UI is rendered by stateless implementations of the Painter interface. The colors, icons and fonts are stored in UIDefaults, where they can be customized or read for skinning components to fit within the Nimbus LAF. Nimbus is likely to be more CPU/GPU-intensive than previous look and feels, but still quite fast. The painters are 'drawn' built using a new visual tool:

We have built this tool that is like a mini Photoshop or Illustrator that lets you graphicaly draw all the 2D vector graphics for each of the states of the components. Those graphics are then compiled into Java2D painting code which is exposed as simple Painters to the LookAndFeel. It has support for advanced features like sub-pixel acuracy, complex gradients, layers and layer effects like drop shadow and glow. The tool is still something internal that we have hacked together but we are working on getting it opensourced and making it into something you will be able to use. Both for creating new look and feels and for drawing painters that you may want to use anywhere in your application.

The first alpha build will be available shortly. In the meantime, you can stay in touch with Java and Java SE news here at InfoQ.

Rate this Article