Menu Shell 2 : Menu « SWT JFace Eclipse « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » SWT JFace Eclipse » MenuScreenshots 
Menu Shell 2
Menu Shell 2


import org.eclipse.swt.SWT;
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 MenuShell2 {
  Display d;

  Shell s;

  MenuShell2() {
    d = new Display();
    s = new Shell(d);
    s.setSize(500500);
    s.setText("A Shell Menu Example");

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

    MenuItem file = new MenuItem(m, SWT.CASCADE);
    file.setText("File");
    Menu filemenu = new Menu(s, SWT.DROP_DOWN);
    file.setMenu(filemenu);
    MenuItem openItem = new MenuItem(filemenu, SWT.PUSH);
    openItem.setText("Open");
    MenuItem exitItem = new MenuItem(filemenu, SWT.PUSH);
    exitItem.setText("Exit");

    s.setMenuBar(m);

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

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


           
       
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
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)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.