score:1

this snippet shows how to create a drop down menu. to get the radio buttons, use the swt.radio style instead of swt.push for the menuitems.

final toolbar toolbar = new toolbar (shell, swt.none);
rectangle clientarea = shell.getclientarea ();
toolbar.setlocation(clientarea.x, clientarea.y);
final menu menu = new menu (shell, swt.pop_up);
for (int i=0; i<8; i++) {
    menuitem item = new menuitem (menu, swt.push);
item.settext ("item " + i);
}
final toolitem item = new toolitem (toolbar, swt.drop_down);
item.addlistener (swt.selection, new listener () {
    public void handleevent (event event) {
        if (event.detail == swt.arrow) {
        rectangle rect = item.getbounds ();
    point pt = new point (rect.x, rect.y + rect.height);
    pt = toolbar.todisplay (pt);
    menu.setlocation (pt.x, pt.y);
    menu.setvisible (true);
        }
}
});
toolbar.pack ();

Related Query

More Query from same tag