Archive for the 'Java' Category

JavaOne 2008 Papers

Tuesday, October 30th, 2007

Its already that time of year again to start writing up all your great ideas for Java One Desktop talks for next year. Its only two and a half weeks till they close for submissions so hurry up. Click here for details for paper submission.

I am planning on submitting a talk on Nimbus and the new Nimbus Designer tool. Covering:

  • Using Nimbus L&F in your applications
  • Designing for cross-platform, how to design your application to look good on all platforms
  • Customizing Nimbus
  • Creating new look and feels using the designer tool based on Nimbus
  • Creating your own components with Nimbus L&F themeing support
  • Designing the look for your own components using the deisgner tool

Might have too much to cover in a hour, don’t want to scare you all off. Any thoughts on what topics you think are the most important/intresting in case I need to cut bits out or anything I didn’t mention here?

JavaOne 2008

Come join the Swing Team

Tuesday, October 30th, 2007

Swing Duke

We are looking for someone to come join us and help develop the next generation of Java Desktop. Lots of cool fun projects looking for a passionate Swing guru.

  • Experience with developing Swing applications required.
  • Passion for Desktop and Rich Client Applications
  • Interest in designing new API for future versions of Java
  • Interested in helping write cool demos for Java One and just generally showing off our technology
  • Need to be in the San Francisco Bay Area or willing to move there. Also you need to be a US citizen or be able to get a visa to work in the US.

This is an amazing opportunity to work with the team who have created and shaped Desktop Java with the chance to influence the future of Java yourself. If you are interested then you can email me via the link below. Please send screenshots or links to any Swing applications you have worked on.

Email Me

Nimbus Early Access

Monday, October 1st, 2007

Finally a version you can all go and play with. Nimbus is coming out as part of “Java SE 6 update N” formerly known as the “Consumer Release” and “Project Hamburg”. Well whatever it is called it contains a decent version of the new Nimbus look and feel. You can go and download it from Java SE 6 Update N Early Access Program. Its is definately not 100% finished yet, there are a few areas that we are still working on:

  • Tabs
  • Focus handling is missing from Spinner,Slider, Tree, Table and List
  • FileChooser has a lot of issues
  • Right to Left for international language support
  • 3rd party component theming
  • Color theming
  • Lots of minor things like table gridlines or setContentAreaFilled() support on buttons
  • Exceptions are thrown if the window or some components get too small

Most of these will be fixed in the next EA release or the first beta release. A few of them have been fixed in the last couple weeks, I have just been working on color theming. All colors in Nimbus are derived from a set of UIDefault colors with Hue, Saturation and Brightness offsets. This gives you reasonable control over changing the colors of the Nimbus Look and Feel.

Dark NimbusDarker Themed Nimbus

Using Nimbus

There are 3 easy ways to use the Nimbus look and feel:

  1. If you query UIManager for a list of available look and feels then Nimbus will show up in the list
  2. Add UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); to your application before creating any Swing components
  3. To specify the L&F from command line, use the following when running your Java application: -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

The reason Nimbus is in the sun.swing… package is it is not possible to add new API to the javax.swing… package in a update release. We hope that we can move Nimbus to javax.swing in Java 7 and if it turns out to be popular then we push to make it the default look and feel in 7. Before 6 update N is final we will work out some way for you to be able to use it now and when it is potentially moved without changing any code.

If you Find Bugs

You can search to see if there is an existing at Sun Bug Database or you can view a List of open Nimbus Bugs. You are welcome to post bugs here as comments and I will file them if they are not known bugs.

Other Cool Features of Update N

Improved performance

  • The Quick Starter feature will prefetch portions of the JRE into memory, substantially decreasing the average JRE cold start-up time (the time that it takes to launch a Java application for the first time after a fresh reboot of a PC).
  • Hardware acceleration support: Java SE 6 Update N introduces a fully hardware accelerated graphics pipeline based on the Microsoft Direct3D 9 API, translating into improved rendering of Swing applications which rely on translucency, gradients, arbitrary transformations, and other more advanced 2D operations.

Enhanced JRE installation experience 

  • The Deployment Toolkit takes the guess work out of determining what versions of the JRE end users have installed on their PC. It supplies Java based web applet/application deployers with a simple interface to accomplish Java detection and installation.
  • The Kernel installation mode lets first time Java users run applets and Web Start applications without waiting for the whole JRE download. While the default Kernel installation will work with existing Java applets, application developers have the ability to select libraries that should be installed with the kernel, before the rest of the JRE is installed on the end user’s system.
  • For current users of Java SE, the JRE update mechanism has also been improved, using a patch-in-place mechanism that translates in a faster and more reliable update process (the patch in place mechanism will take effect for end users who upgrade from this update release or later to a new update release). As an added benefit, follow-on update releases will no longer be listed as separate items in the Windows “Add or Remove Programs” dialog.
  • A new Java update download engine provides end users with the convenience of pausing and resuming the JRE download, and relies on a more reliable download mechanism.

Nimbus almost done

Saturday, September 8th, 2007

Finally we are almost done with Nimbus and I am very pleased with the way it looks. There are many small details that need to be pollished and a couple of big ones like tabs but they will all be done by the time it gets released. I thought it might be time to tease you with some screenshots and details to keep you hungry.

Nimbus Buttons Windows XP
Nimbus Buttons on Windows XP

Technology

I think we have also made some exciting technology behind nimbus it’s not just another standard hard coded swing look and feel

2D Vector

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.

High DPI Ready hd ready

As the whole of Nimbus is drawn with shapes and gradients it can be scaled to any resolution. You will not be able to control this yet but watch for it in the near future.

Based on Painters

All painting for components is done with simple stateless implementations of the Painter interface. These painters are stored in the UIDefaults table so they can be replaced if you would like to change the look of components or can be used in your own components if you would like to create a custom table header for example that looks the same as the standard Nimbus one plus something extra.

Customizable

All colors, icons and fonts are derived off UIDefaults keys so the whole UI can be customized by changing values in the UiDefaults table.

Easy to skin 3rd party components to fit in

All of the colors, fonts, icons, borders and painters are exposed through the UIDefaults table which means they are available to your 3rd part components to help you skin them in a Nimbus style.

I saved the best for last….

Nimbus was drawn graphicaly in a new tool we have been building. Almost none of it was hand coded. 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. I am looking forward to being able to release it.

Well I hope you are as excited as I am about Nimbus and can’t wait to try it out in your own apps. You should not have to wait to long for the first public alpha build. :-)

Nimbus OptionPanes Solaris
Nimbus Option Pane Dialogs on Solaris

SVG Shape 2 Java2D Code

Sunday, July 8th, 2007

A couple weeks ago I needed to write some Java2D code to draw a water droplet. If you have ever tried coding bezier paths off the top of you head it is not the simplest of things and can be frustrating. So I ended up drawing it in Illustrator and saving as SVG. The next stage was hacking with some code I had from before to take the path and spit out Java2D code for the shape. I have been thinking since that I could cleanup the code when I get the time and make a little application for extracting path shapes from SVG and writing out the Java2D code for them. Well I finally got the time and here is what I came up with.

SvgShapeExtractor Screen Shot

Download:
SvgShapeExtractor.jar (Executable Jar)
SvgShapeExtractorSrc.zip (Src)

Hopefully you will find this useful next time you need to write some Java2D shape code.