Menu Shell : Menu « SWT JFace Eclipse « Java






Menu Shell

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;

public class MenuShell {
  Display d;

  Shell s;

  MenuShell() {
    d = new Display();
    s = new Shell(d);
    s.setSize(500, 500);
    s.setImage(new Image(d, "java2s.gif"));
    s.setText("A Shell Menu Example");

    Menu m = new Menu(s, SWT.BAR);
    s.setMenuBar(m);

    s.open();
    while (!s.isDisposed()) {
      if (!d.readAndDispatch())
        d.sleep();
    }
    d.dispose();
  }

  public static void main(String[] argv) {
    new MenuShell();
  }

}

           
       








Related examples in the same category

1.SWT Menu and menu eventSWT Menu and menu event
2.Shared Menu in SWTShared Menu in SWT
3.Menu Examples Menu Examples
4.Demonstrates menusDemonstrates menus
5.Menu Shell 2Menu Shell 2
6.Menu Shell 3Menu Shell 3
7.Menu Shell 4Menu Shell 4
8.Menu Shell 6Menu Shell 6
9.Menu Shell 5Menu Shell 5
10.SWT Menu ExampleSWT Menu Example
11.Show a popup menu (wait for it to close)Show a popup menu (wait for it to close)
12.Fill a menu dynamically (when menu shown)Fill a menu dynamically (when menu shown)
13.Enable menu items dynamically (when menu shown)Enable menu items dynamically (when menu shown)
14.Create a menu with radio itemsCreate a menu with radio items
15.Create a popup menu (set in multiple controls)Create a popup menu (set in multiple controls)
16.Create a bar and pull down menu (accelerators, mnemonics)Create a bar and pull down menu (accelerators, mnemonics)