mac_widgets_snow_leopard

Mac Widgets for Java has been updated to work with Snow Leopard. The Unified Tool Bar, Preferences Bar and Bottom Bar all needed small updates. The textured window in Snow Leopard uses slightly lighter colors, possibly to compensate for the increased gamma correction values, which causes everything to look darker and more saturated.

These updates will be part of the next release (0.9.6), but you can also download the latest developer build here. Be sure to report any issues you have on Snow Leopard, as well as any regressions on Leopard.

iAppScrollbar_top_and_bottom
Thanks to Kathryn Huxtable, Mac Widgets for Java now offers iApp scrollbars with buttons at the top-and-bottom/left-and-right (instead of together at the bottom/right).

I’ve incorporated Kathryn’s changes, which you can get via the Subversion repository or via the latest developer build. To split the buttons, as seen in the screen shot above, call IAppWidgetFactory.setIAppScrollBarButtonsSeparate(true).

iTunes_Table-promo-new
HUDControlsUpdate1-promo-updated
I’ve just released Mac Widgets for Java 0.9.5 (download it here). The major addition in this release is an iTunes style table. I’ve also added a HUD style radio button, made HUDs transparent on non-Mac platforms and completed a number of SourceList enhancements and bug fixes.

Users of the Unified Tool Bar and Bottom Bar will note that these components have been promoted to full classes rather than the awkward factory methods (which had been located in MacWidgetFactory). The API is still evolving, most liking breaking API consumers on upgrade, which is why I’m keeping the library pre-1.0.

You’ll find the full list of enhancements and fixes here, or you can browse the API here. Also, you can see an example that uses the new iTunes table here.

hud_on_windows

I finally got around to making the Heads Up Display (HUD) use transparency on non-Mac platforms. I wanted to keep compatibility with Java 5, so I decided to use reflection to try and gracefully use the com.sun.awt.AWTUtilities.setWindowOpaque method. Here are the two utility methods I use to make a window non-opque:

    /**
     * Try's to make the given {@link Window} non-opqaue (transparent) across
     * platforms and JREs. This method is not guaranteed to succeed, and will fail
     * silently if the given {@code Window} cannot be made non-opaque.
     *
     * This method is useful, for example, when creating a HUD style window that
     * is semi-transparent, and thus doesn't want the window background to be
     * drawn.
     * @param window the {@code Window} to make non-opaque.
     */
    public static void makeWindowNonOpaque(Window window) {
        // on the mac, simply setting the window's background color to be fully
        // transparent makes the window non-opaque.
        window.setBackground(new Color(0, 0, 0, 0));
        // on non-mac platforms, try to use the facilities of Java 6 update 10.
        if (!PlatformUtils.isMac()) {
            quietlyTryToMakeWindowNonOqaque(window);
        }
    }

    /**
     * Trys to invoke {@code com.sun.awt.AWTUtilities.setWindowOpaque(window, false)}
     * on the given {@link Window}. This will only work when running with JRE 6 update 10
     * or higher. This method will silently fail if the method cannot be invoked.
     * @param window the {@code Window} to try and make non-opaque.
     */
    private static void quietlyTryToMakeWindowNonOqaque(Window window) {
        try {
            Class clazz = Class.forName("com.sun.awt.AWTUtilities");
            Method method =
                    clazz.getMethod("setWindowOpaque", java.awt.Window.class, Boolean.TYPE);
            method.invoke(clazz, window, false);
        } catch (Exception e) {
            // silently ignore this exception.
        }
    }

This enhancement will be part of Mac Widgets for Java 0.9.5, which will hopefully be out in the next few weeks. If you want access earlier, you can either download the code and build it from the Subversion repository, or you can email me and I’ll send you the latest jar file.

Swing can be oh so sweet

March 23, 2009

If you had any doubts that Swing could deliver truly beautiful apps, then check out Dirk Lemmermann’s latest endeavor below, which is using Mac Widgets for Java. Dirk is working on a product to enable collaborative enterprise project and issue management, called “Planner’s Workbench”, which he’s aiming to release this summer. He’s really helped refine and improve the Mac Widgets for Java API, as he’s really using this stuff.

By the way, if Dirk’s name sounds familiar, that’s probably because your familiar with his powerful FlexGantt UI Framework (another really nice piece of work).

bild-6
bild-3
bild-3-1
bild-2
bild-4

hudcontrols-promo-new
darksourcelists-promo-new
I’ve just released Mac Widgets for Java 0.9.4. The major additions in this release are HUD style controls and the Dark Source List. Also, Source List colors can be fully customized via the new SourceListColorScheme interface.

You’ll find the full list of enhancements and fixes here, or you can browse the API here. Also, you can see examples that use these new widgets here.

iappscrollbars-promo-new

I’ve just released Mac Widgets for Java 0.9.3. The major addition is iApp style scroll bars, which you can learn how to use here. You’ll find the full list of enhancements and fixes here.

In the next few posts, I’ll be talking about the SkinnableScrollBarUI delegate and supporting infrastructure I created to support creating the iApp scroll bars.

Mac Widgets for Java – 0.9.2

September 29, 2008


I’ve just released Mac Widgets for Java version 0.9.2. I’ve added a Heads Up Display (HUD) component and factored out the UI delegate from SourceList so that you can make any JTree look like a Source List. You’ll find the full list of enhancements and fixes here.

Mac Widgets for Java – 0.9.1

September 14, 2008

Java Unified Tool Bar
Java Bottom Bar
I just released Mac Widgets for Java version 0.9.1. I’ve added official support for the Unified Tool Bar and Bottom Bar, and refactored various bits of the API based on the great feedback I’ve received so far. The API is still fluid, so don’t be surprised if your code requires minor tweaks with the latest version. Also, a few people have asked for runnable demo code, which you’ll now find under the demo directory in the Subversion repository.

What components are coming next? A preferences widget and Heads Up Display (HUD) are on the way. What widgets would you like to see?

The source code for Mac Widgets for Java is now available here. Also, check out this article that builder au (an Australian developer site) just did on the release of the project. Below are my full responses to their questions, which don’t appear in the article.

1. Why did you start the project? I started Mac Widgets for Java because I wanted to see higher fidelity, higher quality Java applications on the Mac. It can be quite time consuming to recreate what Apple offers via Interface Builder. What really made me cringe, though, was seeing poorly designed Mac style components that didn’t quite match what OS X offers – user’s pick up on the tiniest details like incorrect font sizes or minor differences in color and gradient. I wanted to help the reputation of Java user interfaces on the Mac while giving Mac Java developers a set of straight forward, easy to use widgets that their end users would see as native OS X components.

2. How hard was it once you had the idea to create this? Mac Widgets for Java was born out of a demo application for my June 2008 talk at Java One (slides available here, and audio here ). I wanted a really slick, “Mac looking” demo application – I ended up writing what would be the beginning of Mac Widgets for Java. The most difficult component to write (thus far) has been the Source List, which I explored on my blog over the couple of months it took to develop. It’s the subtle details, like the feint drop shadow under a Source List categories label text, that consume the majority of development time.

3. Where do you see the project going? Right now, the only officially supported component is the Source List, but in the coming weeks, I plan to add full support for the following (note that the components below are actually in the current code base, but aren’t fully documented yet):

  • Unified toolbar (see the Window Elements section in the Apple Human Interface guidelines for details)
  • Bottom bar (see the Window Elements section in the Apple Human Interface guidelines for details)
  • Preference tab bar

4. Are you looking for external contributions to help you? I’m not actively looking for external contributors right now, but I’d certainly be willing to consider it. I’m really focused on the quality and simplicity of the API and underlying code as well as the visual integrity of components, so I may be somewhat ruthless when accepting contributors!

5. Additional comments? The API was developed with a component based architecture in mind. Thus my focus was on providing small independent units. I wanted to avoid huge inheritance hierarchies that are all to prevalent in Swing, in an effort to keep the API surface area as small as possible. Using the library may feel awkward for some developers that are used to extension, but I think most will come to find the API refreshingly simple.