Posted on Oct 1, 2007

Nimbus Early Access

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.

42 Comments

  • [...] mildly unexpected announcement on Jasper’s blog (a little earlier than hinted previously) that leads to this page on JDK 6.0 [...]

  • Mark M says:

    I see that you are running with Nimbus on OS X. Which version of Java are you using there?

  • jasper says:

    Mark, I am using Apples Java 6 b88 beta version that has been around for over a year its rather buggy but I can live with it. I am compiling the new Swing as a jar and running it with -Xbootpath. You used to be able to download it for free from the Apple Developer Connection but they have recently removed it. I am so looking forward to a proper version of Java 6 for the Mac. In a few weeks time when Leopard comes out there should be a real Java 6 released shortly after. I have seen it demoed and it rocks, the new Apple look and feel is very smooth and well done. You will be able to create Java applications for the Mac and not be able to tell that they are not native. I can’t wait :-)

  • Peter Kirn says:

    Jasper, maybe you can’t comment on this yet, but what will Java 6 for Mac + Swing performance? (Or Linux, for that matter…) It sounds from the description above like 3D performance relies on Direct3D. Is it able to use OpenGL pipelines on other platforms?

    Very encouraging to see you happy with Java 6 for Mac, as others write it off. Viva cross-platform.

  • Peter Kirn says:

    Oh, and one other comment: I have to say, while native is nice, Nimbus looks great on Mac. It’s a lovely look and feel, very Mac-like, and I think prettier than the Adobe Flex stuff (which is itself very stylish).

  • jasper says:

    Peter: I am looking forward to getting some performace benchmarks but at the moment Nimbus with all its Java2D painting code includeing AA is very fast on my Mac laptop with Apple Java 6 and Software Pipeline. Its even faster in windows at first glance but I would like to see some hard numbers.

  • Manuel says:

    With synthetica I can set a font.

    UIManager.setLookAndFeel(new SyntheticaStandardLookAndFeel());
    SyntheticaLookAndFeel.setFont(“Arial Unicode MS”, 14);

    There is no setFont method for nimbus. I want to output chinese charcters and if I don’t use the unicode font I just get little boxes!

    All help appreciated

  • Bahadir Yagan says:

    Hi!
    I have previously submitted this bug to java.net.
    https://nimbus.dev.java.net/issues/show_bug.cgi?id=11

    It is not listed on the bugs.sun.com. Just a little confused about the existence of two different bug trackers. So I am posting this as a comment hoping it is not lost before the final release :)

    I think that is classic bug now which exists in most of the Sun products in beta state.

    —————————————————————————————–

    A ParseException is thrown while running StartSwingSet. Source of the exception
    is the upper form of letter ‘i’ is ‘İ’ in Turkish and that prevents parsing of
    nimbus.xml file.

    Calling toUpper/toLower methods with the English Locale will fix the problem.

    Exception in thread “main” java.text.ParseException: Error parsing: org.xml.sax.
    SAXException: bind: unknown type REGİON null
    at javax.swing.plaf.synth.SynthParser.parse(Unknown Source)
    at javax.swing.plaf.synth.SynthLookAndFeel.load(Unknown Source)
    at
    org.jdesktop.swingx.plaf.nimbus.NimbusLookAndFeel.(NimbusLookAndFeel.java:35)
    at StartSwingSet.main(StartSwingSet.java:38)

  • M.A.G. says:

    A possibly trivial bug (or a stupid mistake from me) but when running under Nimbus a call to UIManager.getFont(“Label.font”); return null. This works in the other L&F instances I’ve used and I would have thought it should work under Nimbus. Given that at the time I am making the call I have already created a JLabel instance I can swap this code for label.getFont() but it doesn’t seem quite so clean. Any suggestions? Is this my misunderstanding of the UIManager or is it a problem with Nimbus?

  • James says:

    I have to say that the L&F looks really polished – however it also looks very drap and depressing.

    The blues are cold – and I’m not sure I would enjoy working with applications all day long that made me feel that way.

    Is the pallette customizable – i.e. could it use greens instead of blues which give a less depressing feel than the muted blues?

  • Richard Bair says:

    Manuel: How look and feels deal with fonts is totally different from one to the next. In Nimbus, we have an entry in UIDefaults called “defaultFont”, which is pretty much used everywhere. So you might try putting your font into UIManager. Should work.

    Bahadir Yagan: We’ll look into this one. Should be easy to fix, I guess. Surprised it breaks! Seems like an XML document specified as UTF-8 would always just work.

    M.A.G.: You really can’t expect keys from one LAF to be there for another, especially since these keys are not defined in any kind of specification. I’m not sure any synth look and feel supports this key, for instance. Synth is more complicated, in that the font to use depends on the state of the component. So for example, JLabel might use a normal font when the component is ENABLED, but a bold font when MOUSE_OVER. So there isn’t always a good answer for what “Label.font” would mean.

    That said, Jasper and I should talk about it. We want people to be able to use Nimbus with minimal modifications to existing code. I’m worried that if we start down the road of supporting UI Manager keys that other LAFs use, then we’ll end up with a big mess. Most likely, our suggestion will be to either get the Font directly from JLabel, or access the Nimbus/Synth APIs directly (getting a NimbusStyle from NimbusLookAndFeel, setting up a SynthContext and passing that into the style to get the right font for the specified state).

  • Richard Bair says:

    James: If you look closely, you’ll notice that the screenshot above has darker colors than the normal Nimbus. Which is to say, theming is definitely supported. Hopefully there is enough support to get what you want. Jasper has just put back a huge fix for derived colors, which should be available in b06.

  • jasper says:

    James: It depends what you are looking at, the screenshot above is a darkened version of the normal Nimbus which I did for the designer too. You will be able to change the colors to Nimbus but there are not many other colors that look good with the design.

  • alexsmirnov says:

    I’m attempted to run Jdk 1.6 EA samples with default Nimbus L&F ( by -Dswing.defaultlaf=sun.swing.plaf.nimbus.NimbusLookAndFeel command line option ), but see no changes.
    I’m use Fedora core 7 Linux, Gnome windows manager.

  • Milind Rao says:

    I agree with James. Nimbus looks incredibly drab and gloomy. Which is why I never had any enthusiasm for it. I’m glad that it allows theming. But please consider changing the default colors. This is the same reason I thought Firefox sucked when the first beta/alpha release came out. It had a crummy looking UI. Even now, the default colors, tabs, icons in Firefox look dull. I’m sold on Firefox now, but first impressions matter and it took me a while to switch from Mozilla to Firefox. A L&F should look good in the default configuration. Of course this is my opinion. You should probably do a survey to see if I’m in the majority or not.

    As far as hardcoding labels, I agree completely. But I have code to make my app work with various L&F all of which have been derived from Metal which used the darn string constants. So if I suspect a lot of people who have code like the following are going to run into problems.

    UIManager.getColor(“TableHeader.foreground”),
    UIManager.getColor(“TableHeader.background”),
    UIManager.getFont(“TableHeader.font”),
    works with Nimbus, but
    UIManager.getFont(“Table.font”)
    returns a null.

  • Peter Olte says:

    Hi Jasper,
    It looks slick but I must question the decision to have asymetrical thumbs on the scroll bars… The rounded right side just dosent seem right to me.
    cheers,
    Peter from Toronto

  • jasper says:

    alexsmirnov: The -Dswing.defaultlaf=sun.swing.plaf.nimbus.NimbusLookAndFeel only works if you don’t set the look and feel in code as it just changes the default.

    Milind Rao: We don’t have control of the default Nimbus colors as it is already deployed on Solaris as a GTK theme but you can change it to how you like. We will definatly look into supporting some default ui keys.

  • Kishore says:

    Nimbus is beautiful.

    Just waiting for Kernel.

  • [...] Jasper Potts Blog – Nimbus Early Access [...]

  • Keith says:

    Nice work, looks good. Just two problems, changing LnF’s at runtime doesn’t work properly – the grey background of nimbus remains when changing to Metal for example. Another small thing, verticall-snapped-on toolbars don’t seem to paint their buttons. They work when horizontal, but not vertical. Thanks, Keith

  • Jon Seltzer says:

    It’s a little too pastel for my taste. Any chance of a darker theme?

  • Dirk says:

    I keep getting a NPE when trying to use colors retrieved from the UIManager: UIManager.getColor(“Tree.selectionBackground”) returns NULL.

  • Dirk says:

    Oops .. just saw the answer above regarding UIManager.getFont(…. returning null. I guess that explains my problems, then again, I use UIManager.get() quite extensively and wasn’t aware that they can return NULL values.

  • scotty69 says:

    Nice indeed. But I suggest to update the WebStart demo at nimbus.dev.java.net also. For people who just want get a quick glance at the latest and greatest Nimbus, the JDK/JRE early access is ways too clumsy (tweak the SwingSet-demo with -Dswing.defaultlaf=sun.swing.plaf.nimbus.NimbusLookAndFeel to see Nimbus in action). And yes, jconsole crashes with an NPE when launched with a -J-Dswing.defaultlaf switch (bug report already filed).

  • Jonathan Johnson says:

    I have some LAF requirements that have different panel background colors, buttons and font sizes.

    How would one derive or inherit and tweak from nimbus?

    Perhaps one could extend from NimbusLookAndFeel, read the nimbus.xml file, transform the xml elements and attributes of interest and submit the transformed XML to the SynthLookAndFeel.load method?

  • jasper says:

    Jon Seltzer: You will be able to change the colors to your taste.

    Jonathan Johnson: The reason your comment didn’t appear immediately is I moderate all comments so I can filter out the 50% of spam. You will have a lot of control to customize Nimbus, we have just been working on a cool new feature that will let you replace the painters for any component instance with your own. So you can theme components on a component by component basis. Once we release our design tool you will be able to load the nimbus look and feel porject as a example and create your own derived LAFs. The nimbus xml is the old way nimus was built in thr first prototype that is up on the java.net project. The new version has a different xml file as its base which is compiled into Java code for the look and feel. We are working on a graphical tool for editing that xml file and building a look and feel jar at the end.

  • Jonathan Johnson says:

    Jasper: That explains why I could not find a nimbus.xml in the Java SE 6 Update N early edition. I’m glad you told me since I was about to head in the wrong direction by transforming the xml. The old nimbus source on java.net is a bit misleading then, and as scotty69 said the demo is dated as well. I’m looking forward to trying what you have. “a graphical tool for editing that xml file and building a look and feel jar at the end” sounds perfect.

  • Ken Orr says:

    Jasper,

    Nimbus looks fantastic – including the elegant implementation! I’m curious how the L&F handles the idea of small, medium and large components – that is, at what point does it check the size property?

    -Ken

  • i30817 says:

    At least some system colors are fubared in update java6 build 5 update 6 (or was it the other way arround)
    Sepecifcally SystemColor.textText is WHITE and considering that SystemColor.text (the background default) seems to be also white, i cant see anything.

  • Jasper Potts says:

    i30817: I have done a little digging about SystemColor as I was very supprised in my 10 years of Swing I had never come across it. Anyway the colors for SystemColor are derived from the native platform by AWT and have nothing to do with Swing look and feels. So Nimbus has no effect on them. If there is a issue with them in Java 6uN_b06 then its a AWT bug. What platform are you running on? The best thing you could do is file a bug with Sun and this will be looked at by the person responsable. If you send me the bug number than I can see what I can do to chase up and make sure its fixed.

  • Rich says:

    I’d put this on the sun bug database for you, but I just can’t put up with it this evening! I get it setting the LnF to nimbus with the latest weekly build.

    Exception in thread “AWT-EventQueue-0″ java.lang.NullPointerException
    at javax.swing.JTable.setSelectionBackground(JTable.java:2454)
    at javax.swing.plaf.synth.SynthTableUI.updateStyle(SynthTableUI.java:117)
    at javax.swing.plaf.synth.SynthTableUI.installDefaults(SynthTableUI.java:95)
    at javax.swing.plaf.basic.BasicTableUI.installUI(BasicTableUI.java:1354)
    at javax.swing.JComponent.setUI(JComponent.java:673)
    at javax.swing.JTable.setUI(JTable.java:3526)
    at javax.swing.JTable.updateUI(JTable.java:3582)
    at javax.swing.JTable.(JTable.java:614)
    at javax.swing.JTable.(JTable.java:539)
    at org.htu.tsd.Table.(Table.java:28)
    at org.htu.tsd.TSDFrame.initComponents(TSDFrame.java:120)
    at org.htu.tsd.TSDFrame.(TSDFrame.java:30)
    at org.htu.tsd.TSDFrame$13.run(TSDFrame.java:358)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

  • Jasper Potts says:

    Rich: I will look into it on monday. Seems like a funny error.

  • Mario says:

    Hello,

    I was wondering if there was any resolution to the issue with the NullPointerException regarding the exception posted above on 11-9-2007. I think this is a result of the previous questions regarding certain keys in UIManager returning null in general.

    I took a look through the bug database with the keyword nimbus AND JTable and I couldn’t find any issue like the above. Can someone point me to the correct location for the issue, or for a workaround if there is one?

    Thanks in advance!

  • Jasper Potts says:

    Mario: There is some big issue with renderers with Trees, Tables, Lists and Combos which is being worked on at the moment in bug 6595814 it should be fixed in b11 or b12. This issue is related to the same problem.

  • Mario says:

    Ah! Thanks much. So at the moment, is there a work-around that will allow me to view the rest of my application in Nimbus and simply have the renderer based items fall back to some other default (OS, other LAF, etc…). Can I set some of those keys directly after switching to Nimbus?

    Basically I would like to be able to start reviewing and testing with the LAF, both for our purposes as well as for providing feedback, however we cannot do so without our tables. :)

    Thanks again!

  • Adam says:

    Unless I’m making a n00b mistake, you should update the instructions to load Nimbus. It should be:

    UIManager.setLookAndFeel(“com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel”);

    not UIManager.setLookAndFeel(“sun.swing.plaf.nimbus.NimbusLookAndFeel”); (this is what you have). The method you have will not work (at least for me using the java6u10 beta installed on April 8).

  • Jasper Potts says:

    Thanks Adam you are right the package for Nimbus changed between early builds and the beta. I will release a blog with more info about the beta once I am back from vacation next week.

  • Larry Barowski says:

    So will there be a way to scale the UI globally? If so, is this available yet? I didn’t see anything in the methods or UIDefaults that looked promising. Under all previous Sun L&Fs except GTK, it is possible to scale all fonts by iterating through the UIDefaults and replacing every font value with a scaled instance, but this doesn’t work under Nimbus because it uses some of those fonts/sizes but not others – trying to do so futzes up the layouts. That is not a problem if there is a way to do a global UI scale which includes all fonts.

  • Jasper Potts says:

    Larry: We always planned Nimbus to be scaleable and put effort into making it possible at the core. We just never had time to finish it so did not expose control. Hopefully this is something we can resolve when we do Nimbus for JDK 7. On changing the font, try setting the “defaultFont” key in UIManager probably before Nimbus is loaded but should work after but I have never tried.

  • Larry Barowski says:

    Using “defaultFont” shows the same problem as just scaling all the UIDefaults fonts – some fonts scale but most don’t. I would also suggest you scale fonts by default based on the system DPI, as the Windows L&Fs do on Windows and the Mac L&Fs do on Macs (but Metal and Motif L&Fs don’t). Otherwise, on high dpi systems, the fonts are too small. In our app we compensate for that on Metal and Motif by applying the DPI scaling ourselves automatically (as well as allowing the user to globally scale the UI fonts by any amount on top of that). Not having time is something I well understand, but in my opinion global font scaling is a major usability issue for a L&F.

  • Jill Wright says:

    I have some LAF requirements that have different background colors, will require a button painter, and font sizes.

    How would one derive or inherit and tweak from nimbus?

    Can one could extend from NimbusLookAndFeel?
    What is the best way to build on or change the Nimbus Look and Feel?

    Is that talked about Nimbus Design tool still going to happen?

  • Diego says:

    I need something like a .jar for use it in a portable form, for use in computers without java 6… anyone knows something??