I wanted the behaviour as shown on the picture. You have an ordinary button (with his whole functionallity) and a menu popup.
The code is finished and ready to use. Just use at your own risk ;-)
http://download.planethost.de/code/DropdownButton.java
Update:
A short snippet for the shell shown above:
public class Snippet { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); shell.setLayout (new RowLayout ()); SelectionListener sl = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { MenuItem mi = (MenuItem)e.getSource(); System.out.println(mi.getText() + " selected"); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }; DropdownButton db = new DropdownButton(shell, "myDropButton", SWT.NONE); db.addMenuItem("item 1").addSelectionListener(sl); db.addMenuItem("item 2").addSelectionListener(sl); db.addMenuItem("item 3").addSelectionListener(sl); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }