The SWT Ribbon API is a SWT Widget modeled after the Office 2007 ribbon. It custom draws things such as split buttons, custom toolbars and even a shell implementation. The API doesn’t use any native API, it’s all SWT.
Features on current version (Alpha2):
- Groups – Named, Hover/Dehover colors, Dividers, Tooltip button corners on/off.
- Buttons – Normal, Toggle, Split, Toggle & Split, Enabled & disabled images. Vertical image alignments. Arrows.
- Tabs – Scrollwheel to cycle, Hover, Selected, Double-click to expand/collapse entire folder
- Checkboxes
- Tooltips – Customizable images, text, sizes, fonts, colors, help icons, help text, rounded shell corners
- Button Dependency Groups – If button A belongs with buttons B and C and A is selected. User presses C. C is selected. A deselects.
- Toolbars – Both bordered toolbars and non-bordered toolbars, including groupings.
- Big button
- Tab-bar help button -
- Menubar toolbar and dropdown area
- Shell – Borders, etc etc
The syntax is very similar to the standard SWT and with almost all parts, you could use the standard SWT widgets too.
To start programming download the Ribbon and SWT libraries and add this JAR’s to your classpath.
import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import com.hexapixel.widgets.generic.ImageCache; import com.hexapixel.widgets.ribbon.RibbonButton; import com.hexapixel.widgets.ribbon.RibbonButtonGroup; import com.hexapixel.widgets.ribbon.RibbonCheckbox; import com.hexapixel.widgets.ribbon.RibbonGroup; import com.hexapixel.widgets.ribbon.RibbonShell; import com.hexapixel.widgets.ribbon.RibbonTab; import com.hexapixel.widgets.ribbon.RibbonTabFolder; import com.hexapixel.widgets.ribbon.RibbonTooltip; public class RibbonTest { public static void main(String[] args) { Display display = new Display(); final RibbonShell shell = new RibbonShell(display); shell.setText("SWT Ribbon Demo"); RibbonTabFolder folder = shell.getRibbonTabFolder(); RibbonTab tab1 = new RibbonTab(folder, "snakedj.ch - swiss java blog"); RibbonTab tab2 = new RibbonTab(folder, "jugr.ch - Java User Group Graubünden"); folder.pack(); RibbonTooltip toolTip = new RibbonTooltip("RibbonTooltip", "This is a RibbonTooltip content text.\n\nhttp://www.snakedj.ch - \\c255000000swiss java blog \\x\nhttp://www.jugr.ch - \\c255000000Java User Group Graubünden \\x", ImageCache.getImage("tooltip.jpg"), ImageCache.getImage("questionmark.gif"), "Press F1 for more help"); RibbonGroup group1 = new RibbonGroup(tab1, "Java", toolTip); new RibbonButton(group1, ImageCache.getImage("olb_picture4.gif"), "J2SE",RibbonButton.STYLE_ARROW_DOWN); new RibbonButton(group1, ImageCache.getImage("olb_picture5.gif"), "J2EE",RibbonButton.STYLE_ARROW_DOWN); new RibbonButton(group1, ImageCache.getImage("olb_picture6.gif"), "J2ME",RibbonButton.STYLE_ARROW_DOWN); RibbonGroup group2 = new RibbonGroup(tab1, "Miscellaneous", toolTip); RibbonButtonGroup buttonGroup = new RibbonButtonGroup(group2); new RibbonCheckbox(buttonGroup, "C++", SWT.NONE); new RibbonCheckbox(buttonGroup, "PHP", SWT.NONE); new RibbonCheckbox(buttonGroup, "PL / SQL", SWT.NONE); new RibbonCheckbox(buttonGroup, "Scala", SWT.NONE); Menu bigButtonMenu = shell.getBigButtonMenu(); MenuItem menuItem1 = new MenuItem(bigButtonMenu, SWT.POP_UP); menuItem1.setText("Item1"); MenuItem menuItem2 = new MenuItem(bigButtonMenu, SWT.POP_UP); menuItem2.setText("Item2"); shell.addBigButtonListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { } @Override public void widgetSelected(SelectionEvent e) { shell.showBigButtonMenu(); } }); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
More informations:
http://hexapixel.com
http://eclipse.org/nebula
http://www.eclipse.org/swt/














Hi! i’m doing the final project in the university.. and need help to do the Ribbon GUI for a math program.. i must know how to use this components without code, fisically such as .NET.
Thanks.
There is no WYSIWYG editor for the SWT Ribbon components.
Hi. i am very interested in this UI. Could you provide some details on how to add action listeners here? Where can I find the documentation on Ribbon widget?