MacWidgets – Java Swing looking native on OS X

I just discovered Exploding Pixels’ MacWidgets. Its a beautiful library. Literally just pasted a couple of lines of code into my Java app and now it looks right at home on the os x desktop. I’m running JDK 1.6 on Leopard.

Here is is in action:

macwidgets-demo

And here is the code (its been edited slightly so may not copy and paste, but you get the idea) …

 
        MacUtils.makeWindowLeopardStyle(getRootPane());
 
        UnifiedToolBar toolBar = new UnifiedToolBar();
 
        JButton button = new JButton(“My Button”);
        button.putClientProperty(“JButton.buttonType”, “textured”);
        toolBar.addComponentToLeft(button);
 
        getContentPane().add(toolBar.getComponent(), BorderLayout.NORTH);
 
        BottomBar bottomBar = new BottomBar(BottomBarSize.SMALL);
        bottomBar.addComponentToLeft(MacWidgetFactory.createEmphasizedLabel(” Status”));
 
        getContentPane().add(bottomBar.getComponent(), BorderLayout.SOUTH);
 
Share