import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
public class MenuItemWithImage {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Menu menuBar = new Menu(shell, SWT.BAR);
Menu fileMenu = new Menu(menuBar);
MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE | SWT.NO_RADIO_GROUP);
fileItem.setText("File");
fileItem.setMenu(fileMenu);
Image yourImage = new Image(shell.getDisplay(), "yourFile.gif");
MenuItem itema = new MenuItem(fileMenu, SWT.NONE);
itema.setText("Radio A");
itema.setImage(yourImage);
MenuItem itemb = new MenuItem(fileMenu, SWT.NONE);
itemb.setText("Radio B");
MenuItem itemc = new MenuItem(fileMenu, SWT.NONE);
itemc.setText("Radio C");
shell.setMenuBar(menuBar);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
}