Ejemplo n.º 1
0
 void createMenuBar() {
   org.eclipse.swt.widgets.Menu bar = new org.eclipse.swt.widgets.Menu(shell, SWT.BAR);
   shell.setMenuBar(bar);
   org.eclipse.swt.widgets.MenuItem fileItem =
       new org.eclipse.swt.widgets.MenuItem(bar, SWT.CASCADE);
   fileItem.setText(resources.getString("File_menuitem"));
   fileItem.setMenu(createFileMenu());
 }
Ejemplo n.º 2
0
 org.eclipse.swt.widgets.Menu createFileMenu() {
   org.eclipse.swt.widgets.Menu bar = shell.getMenuBar();
   org.eclipse.swt.widgets.Menu menu = new org.eclipse.swt.widgets.Menu(bar);
   org.eclipse.swt.widgets.MenuItem item;
   item = new org.eclipse.swt.widgets.MenuItem(menu, SWT.PUSH);
   item.setText(resources.getString("Open_menuitem"));
   item.setAccelerator(SWT.MOD1 + 'O');
   item.addSelectionListener(
       new org.eclipse.swt.events.SelectionAdapter() {
         public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
           openFile();
         }
       });
   item = new org.eclipse.swt.widgets.MenuItem(menu, SWT.PUSH);
   item.setText(resources.getString("Exit_menuitem"));
   item.addSelectionListener(
       new org.eclipse.swt.events.SelectionAdapter() {
         public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
           menuFileExit();
         }
       });
   return menu;
 }