Source Code Cross Referenced for ShellMainMenuBar.java in  » Development » Tracelog » net » sourceforge » tracelog » ui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
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 Source Code / Java Documentation » Development » Tracelog » net.sourceforge.tracelog.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.tracelog.ui;
002:
003:        import org.eclipse.swt.SWT;
004:        import org.eclipse.swt.program.Program;
005:        import org.eclipse.swt.widgets.Event;
006:        import org.eclipse.swt.widgets.Listener;
007:        import org.eclipse.swt.widgets.Menu;
008:        import org.eclipse.swt.widgets.MenuItem;
009:
010:        public class ShellMainMenuBar extends AbstractWidget {
011:            ShellMainMenuBar() {
012:                super ();
013:            }
014:
015:            public void run() {
016:                Menu bar = new Menu(parentShell, SWT.BAR);
017:
018:                Menu fileSubMenu = createSubMenu(bar, "&File");
019:                Menu editSubMenu = createSubMenu(bar, "&Edit");
020:                Menu helpSubMenu = createSubMenu(bar, "&Help");
021:
022:                // file submenu
023:                createMenuItem(fileSubMenu, null, "Exit", 0).addListener(
024:                        SWT.Selection, new Listener() {
025:                            public void handleEvent(Event e) {
026:                                parentShell.notifyListeners(SWT.Close, e);
027:                            }
028:                        });
029:
030:                // edit submenu
031:                createMenuItem(editSubMenu, null, "Options...", 0).addListener(
032:                        SWT.Selection, new Listener() {
033:                            public void handleEvent(Event e) {
034:                                mediator
035:                                        .handleEvent(ActionMediator.EVENT_DISPLAY_OPTIONS);
036:                            }
037:                        });
038:
039:                // introduction submenu
040:                createMenuItem(helpSubMenu, null, "Project Web Page", 0)
041:                        .addListener(SWT.Selection, new Listener() {
042:                            public void handleEvent(Event e) {
043:                                Program.launch(projectProperties
044:                                        .getProjectHomeURL());
045:                            }
046:                        });
047:
048:                // tutorial submenu
049:                createMenuItem(helpSubMenu, null, "Tutorial", 0).addListener(
050:                        SWT.Selection, new Listener() {
051:                            public void handleEvent(Event e) {
052:                                Program.launch(projectProperties
053:                                        .getTutorialURL());
054:                            }
055:                        });
056:
057:                // updates submenu
058:                createMenuItem(helpSubMenu, null, "Find Updates", 0)
059:                        .addListener(SWT.Selection, new Listener() {
060:                            public void handleEvent(Event e) {
061:                                Program
062:                                        .launch(projectProperties
063:                                                .getUpdateURL());
064:                            }
065:                        });
066:
067:                // Report a Bug submenu
068:                createMenuItem(helpSubMenu, null, "Report a Bug", 0)
069:                        .addListener(SWT.Selection, new Listener() {
070:                            public void handleEvent(Event e) {
071:                                Program.launch(projectProperties
072:                                        .getBugReportURL());
073:                            }
074:                        });
075:
076:                // Feedback submenu
077:                createMenuItem(helpSubMenu, null, "Leave Feedback", 0)
078:                        .addListener(SWT.Selection, new Listener() {
079:                            public void handleEvent(Event e) {
080:                                Program.launch(projectProperties
081:                                        .getFeedbackURL());
082:                            }
083:                        });
084:
085:                // Change History submenu
086:                createMenuItem(helpSubMenu, null, "Change History", 0)
087:                        .addListener(SWT.Selection, new Listener() {
088:                            public void handleEvent(Event e) {
089:                                mediator
090:                                        .handleEvent(ActionMediator.EVENT_DISPLAY_CHANGE_HISTORY);
091:                            }
092:                        });
093:
094:                new MenuItem(helpSubMenu, SWT.SEPARATOR);
095:
096:                createMenuItem(helpSubMenu, null,
097:                        "About " + projectProperties.getApplicationTitle(), 0)
098:                        .addListener(SWT.Selection, new Listener() {
099:                            public void handleEvent(Event e) {
100:                                mediator
101:                                        .handleEvent(ActionMediator.EVENT_DISPLAY_ABOUT);
102:                            }
103:                        });
104:
105:                parentShell.setMenuBar(bar);
106:            }
107:
108:            /**
109:             * Creates a menu item.
110:             * 
111:             * @param menu
112:             *            Parent menu.
113:             * @param subMenu
114:             *            Submenu.
115:             * @param menuItemName
116:             *            ShellOptionMenu item name.
117:             * @param accelerator
118:             *            ShellOptionMenu item accelerator.
119:             * @return MenuItem object.
120:             */
121:            private MenuItem createMenuItem(Menu menu, Menu subMenu,
122:                    String menuItemName, int accelerator) {
123:                MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
124:
125:                menuItem.setText(menuItemName);
126:
127:                if (accelerator != 0) {
128:                    menuItem.setAccelerator(accelerator);
129:                }
130:
131:                if (subMenu != null) {
132:                    menuItem.setMenu(subMenu);
133:                }
134:
135:                return menuItem;
136:            }
137:
138:            /**
139:             * Creates a submenu.
140:             * 
141:             * @param menu
142:             *            Parent menu.
143:             * @param subMenuName
144:             *            Submenu name.
145:             * @return ShellOptionMenu object.
146:             */
147:            private Menu createSubMenu(Menu menu, String subMenuName) {
148:                Menu subMenu = new Menu(parentShell, SWT.DROP_DOWN);
149:
150:                MenuItem fileItem = new MenuItem(menu, SWT.CASCADE);
151:                fileItem.setText(subMenuName);
152:                fileItem.setMenu(subMenu);
153:
154:                return subMenu;
155:            }
156:
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.