Java Doc for MenuBar.java in  » 6.0-JDK-Core » AWT » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.MenuComponent
      java.awt.MenuBar

MenuBar
public class MenuBar extends MenuComponent implements MenuContainer,Accessible(Code)
The MenuBar class encapsulates the platform's concept of a menu bar bound to a frame. In order to associate the menu bar with a Frame object, call the frame's setMenuBar method.

This is what a menu bar might look like:

A menu bar handles keyboard shortcuts for menu items, passing them along to its child menus. (Keyboard shortcuts, which are optional, provide the user with an alternative to the mouse for invoking a menu item and the action that is associated with it.) Each menu item can maintain an instance of MenuShortcut. The MenuBar class defines several methods, MenuBar.shortcuts and MenuBar.getShortcutMenuItem that retrieve information about the shortcuts a given menu bar is managing.
version:
   1.79, 05/05/07
author:
   Sami Shaio
See Also:   java.awt.Frame
See Also:   java.awt.Frame.setMenuBar(java.awt.MenuBar)
See Also:   java.awt.Menu
See Also:   java.awt.MenuItem
See Also:   java.awt.MenuShortcut
since:
   JDK1.0


Inner Class :protected class AccessibleAWTMenuBar extends AccessibleAWTMenuComponent

Field Summary
 MenuhelpMenu
     This menu is a special menu dedicated to help.
 Vectormenus
     This field represents a vector of the actual menus that will be part of the MenuBar.

Constructor Summary
public  MenuBar()
     Creates a new menu bar.

Method Summary
public  Menuadd(Menu m)
     Adds the specified menu to the menu bar.
public  voidaddNotify()
     Creates the menu bar's peer.
 StringconstructComponentName()
     Construct a name for this MenuComponent.
public  intcountMenus()
    
public  voiddeleteShortcut(MenuShortcut s)
     Deletes the specified menu shortcut.
 intgetAccessibleChildIndex(MenuComponent child)
     Defined in MenuComponent.
public  AccessibleContextgetAccessibleContext()
     Gets the AccessibleContext associated with this MenuBar.
public  MenugetHelpMenu()
     Gets the help menu on the menu bar.
public  MenugetMenu(int i)
     Gets the specified menu.
Parameters:
  i - the index position of the menu to be returned.
public  intgetMenuCount()
     Gets the number of menus on the menu bar.
final  intgetMenuCountImpl()
    
final  MenugetMenuImpl(int i)
    
public  MenuItemgetShortcutMenuItem(MenuShortcut s)
     Gets the instance of MenuItem associated with the specified MenuShortcut object, or null if none of the menu items being managed by this menu bar is associated with the specified menu shortcut.
 booleanhandleShortcut(KeyEvent e)
    
public  voidremove(int index)
     Removes the menu located at the specified index from this menu bar.
public  voidremove(MenuComponent m)
     Removes the specified menu component from this menu bar.
public  voidremoveNotify()
     Removes the menu bar's peer.
public  voidsetHelpMenu(Menu m)
     Sets the specified menu to be this menu bar's help menu.
public synchronized  Enumeration<MenuShortcut>shortcuts()
     Gets an enumeration of all menu shortcuts this menu bar is managing.

Field Detail
helpMenu
Menu helpMenu(Code)
This menu is a special menu dedicated to help. The one thing to note about this menu is that on some platforms it appears at the right edge of the menubar.
See Also:   MenuBar.getHelpMenu()
See Also:   MenuBar.setHelpMenu(Menu)



menus
Vector menus(Code)
This field represents a vector of the actual menus that will be part of the MenuBar.
See Also:   MenuBar.countMenus()




Constructor Detail
MenuBar
public MenuBar() throws HeadlessException(Code)
Creates a new menu bar.
exception:
  HeadlessException - if GraphicsEnvironment.isHeadless()returns true.
See Also:   java.awt.GraphicsEnvironment.isHeadless




Method Detail
add
public Menu add(Menu m)(Code)
Adds the specified menu to the menu bar. If the menu has been part of another menu bar, removes it from that menu bar.
Parameters:
  m - the menu to be added the menu added
See Also:   java.awt.MenuBar.remove(int)
See Also:   java.awt.MenuBar.remove(java.awt.MenuComponent)



addNotify
public void addNotify()(Code)
Creates the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.



constructComponentName
String constructComponentName()(Code)
Construct a name for this MenuComponent. Called by getName() when the name is null.



countMenus
public int countMenus()(Code)



deleteShortcut
public void deleteShortcut(MenuShortcut s)(Code)
Deletes the specified menu shortcut.
Parameters:
  s - the menu shortcut to delete.
since:
   JDK1.1



getAccessibleChildIndex
int getAccessibleChildIndex(MenuComponent child)(Code)
Defined in MenuComponent. Overridden here.



getAccessibleContext
public AccessibleContext getAccessibleContext()(Code)
Gets the AccessibleContext associated with this MenuBar. For menu bars, the AccessibleContext takes the form of an AccessibleAWTMenuBar. A new AccessibleAWTMenuBar instance is created if necessary. an AccessibleAWTMenuBar that serves as the AccessibleContext of this MenuBar
since:
   1.3



getHelpMenu
public Menu getHelpMenu()(Code)
Gets the help menu on the menu bar. the help menu on this menu bar.



getMenu
public Menu getMenu(int i)(Code)
Gets the specified menu.
Parameters:
  i - the index position of the menu to be returned. the menu at the specified index of this menu bar.



getMenuCount
public int getMenuCount()(Code)
Gets the number of menus on the menu bar. the number of menus on the menu bar.
since:
   JDK1.1



getMenuCountImpl
final int getMenuCountImpl()(Code)



getMenuImpl
final Menu getMenuImpl(int i)(Code)



getShortcutMenuItem
public MenuItem getShortcutMenuItem(MenuShortcut s)(Code)
Gets the instance of MenuItem associated with the specified MenuShortcut object, or null if none of the menu items being managed by this menu bar is associated with the specified menu shortcut.
Parameters:
  s - the specified menu shortcut.
See Also:   java.awt.MenuItem
See Also:   java.awt.MenuShortcut
since:
   JDK1.1



handleShortcut
boolean handleShortcut(KeyEvent e)(Code)



remove
public void remove(int index)(Code)
Removes the menu located at the specified index from this menu bar.
Parameters:
  index - the position of the menu to be removed.
See Also:   java.awt.MenuBar.add(java.awt.Menu)



remove
public void remove(MenuComponent m)(Code)
Removes the specified menu component from this menu bar.
Parameters:
  m - the menu component to be removed.
See Also:   java.awt.MenuBar.add(java.awt.Menu)



removeNotify
public void removeNotify()(Code)
Removes the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.



setHelpMenu
public void setHelpMenu(Menu m)(Code)
Sets the specified menu to be this menu bar's help menu. If this menu bar has an existing help menu, the old help menu is removed from the menu bar, and replaced with the specified menu.
Parameters:
  m - the menu to be set as the help menu



shortcuts
public synchronized Enumeration<MenuShortcut> shortcuts()(Code)
Gets an enumeration of all menu shortcuts this menu bar is managing. an enumeration of menu shortcuts that thismenu bar is managing.
See Also:   java.awt.MenuShortcut
since:
   JDK1.1



Fields inherited from java.awt.MenuComponent
AccessibleContext accessibleContext(Code)(Java Doc)
final static String actionListenerK(Code)(Java Doc)
transient AppContext appContext(Code)(Java Doc)
Font font(Code)(Java Doc)
final static String itemListenerK(Code)(Java Doc)
boolean newEventsOnly(Code)(Java Doc)
transient MenuContainer parent(Code)(Java Doc)
transient MenuComponentPeer peer(Code)(Java Doc)

Methods inherited from java.awt.MenuComponent
String constructComponentName()(Code)(Java Doc)
final public void dispatchEvent(AWTEvent e)(Code)(Java Doc)
void dispatchEventImpl(AWTEvent e)(Code)(Java Doc)
boolean eventEnabled(AWTEvent e)(Code)(Java Doc)
int getAccessibleChildIndex(MenuComponent child)(Code)(Java Doc)
public AccessibleContext getAccessibleContext()(Code)(Java Doc)
int getAccessibleIndexInParent()(Code)(Java Doc)
AccessibleStateSet getAccessibleStateSet()(Code)(Java Doc)
public Font getFont()(Code)(Java Doc)
final Font getFont_NoClientCode()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public MenuContainer getParent()(Code)(Java Doc)
final MenuContainer getParent_NoClientCode()(Code)(Java Doc)
public MenuComponentPeer getPeer()(Code)(Java Doc)
final protected Object getTreeLock()(Code)(Java Doc)
protected String paramString()(Code)(Java Doc)
public boolean postEvent(Event evt)(Code)(Java Doc)
protected void processEvent(AWTEvent e)(Code)(Java Doc)
public void removeNotify()(Code)(Java Doc)
public void setFont(Font f)(Code)(Java Doc)
public void setName(String name)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.