Flamingo ribbon component: small buttons in ribbon galleries

June 10th, 2009

As mentioned in the JavaOne presentation on the Flamingo ribbon component, there are a few small features missing in the Swing implementation. The first drop of version 4.2dev (code-named Hiolair) now provides support for placing small command buttons in ribbon galleries.

A ribbon gallery is a compact way to display a large number of buttons that control the specific visual appearance of the selected document element. The ribbon gallery fits itself to the available horizontal space, and allows two navigation modes:

  • Using the scroll-up and scroll-down buttons to view additional button rows inside the ribbon itself
  • Using the expand button to view all the buttons in a scrollable popup

Here is how a ribbon gallery hosting big command buttons looks like:

And when it is expanded (with the bottom-right button), it looks like this:

Up until now the ribbon has supported placing only big buttons in ribbon galleries. Starting with version 4.2, the new JRibbonBand.addRibbonGallery that gets the CommandButtonDisplayState as one of the parameters can be used to create a ribbon gallery that hosts small command buttons. The following display states are supported:

  • JRibbonBand.BIG_FIXED_LANDSCAPE – this is the default display state. The buttons display big icon and text below it, and the buttons have fixed 5:4 ratio when displayed in the popup.
  • JRibbonBand.BIG_FIXED. The buttons display big icon and text below it, and the buttons have fixed 1:1 ratio when displayed in the popup.
  • CommandButtonDisplayState.SMALL. The buttons display only small icon with no text.

Here is a ribbon gallery that hosts small command buttons (in three rows):

And this is how it looks when it is expanded:

You’re more than welcome to take the first drop of version 4.2dev for a spin. You can also play with the WebStart demo of the ribbon under Substance look-and-feel by clicking on the button below. Switch to “Animations” task for a ribbon gallery with small command buttons.