Java Doc for Menu.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.MenuItem
         java.awt.Menu

All known Subclasses:   java.awt.PopupMenu,
Menu
public class Menu extends MenuItem implements MenuContainer,Accessible(Code)
A Menu object is a pull-down menu component that is deployed from a menu bar.

A menu can optionally be a tear-off menu. A tear-off menu can be opened and dragged away from its parent menu bar or menu. It remains on the screen after the mouse button has been released. The mechanism for tearing off a menu is platform dependent, since the look and feel of the tear-off menu is determined by its peer. On platforms that do not support tear-off menus, the tear-off property is ignored.

Each item in a menu must belong to the MenuItem class. It can be an instance of MenuItem, a submenu (an instance of Menu), or a check box (an instance of CheckboxMenuItem).
version:
   1.85, 05/05/07
author:
   Sami Shaio
See Also:   java.awt.MenuItem
See Also:   java.awt.CheckboxMenuItem
since:
   JDK1.0


Inner Class :protected class AccessibleAWTMenu extends AccessibleAWTMenuItem

Field Summary
 booleanisHelpMenu
     This field will be set to true if the Menu in question is actually a help menu.
 Vectoritems
     A vector of the items that will be part of the Menu.
 booleantearOff
     This field indicates whether the menu has the tear of property or not.

Constructor Summary
public  Menu()
     Constructs a new menu with an empty label.
public  Menu(String label)
     Constructs a new menu with the specified label.
public  Menu(String label, boolean tearOff)
     Constructs a new menu with the specified label, indicating whether the menu can be torn off.

Tear-off functionality may not be supported by all implementations of AWT.


Method Summary
public  MenuItemadd(MenuItem mi)
     Adds the specified menu item to this menu.
public  voidadd(String label)
     Adds an item with the specified label to this menu.
public  voidaddNotify()
     Creates the menu's peer.
public  voidaddSeparator()
     Adds a separator line, or a hypen, to the menu at the current position.
 StringconstructComponentName()
     Construct a name for this MenuComponent.
public  intcountItems()
    
final  intcountItemsImpl()
    
 voiddeleteShortcut(MenuShortcut s)
    
 intgetAccessibleChildIndex(MenuComponent child)
     Defined in MenuComponent.
public  AccessibleContextgetAccessibleContext()
     Gets the AccessibleContext associated with this Menu.
public  MenuItemgetItem(int index)
     Gets the item located at the specified index of this menu.
Parameters:
  index - the position of the item to be returned.
public  intgetItemCount()
     Get the number of items in this menu.
final  MenuItemgetItemImpl(int index)
    
 MenuItemgetShortcutMenuItem(MenuShortcut s)
    
 booleanhandleShortcut(KeyEvent e)
    
public  voidinsert(MenuItem menuitem, int index)
     Inserts a menu item into this menu at the specified position.
public  voidinsert(String label, int index)
     Inserts a menu item with the specified label into this menu at the specified position.
public  voidinsertSeparator(int index)
     Inserts a separator at the specified position.
public  booleanisTearOff()
     Indicates whether this menu is a tear-off menu.

Tear-off functionality may not be supported by all implementations of AWT.

public  StringparamString()
     Returns a string representing the state of this Menu. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations.
public  voidremove(int index)
     Removes the menu item at the specified index from this menu.
public  voidremove(MenuComponent item)
     Removes the specified menu item from this menu.
Parameters:
  item - the item to be removed from the menu.
public  voidremoveAll()
     Removes all items from this menu.
public  voidremoveNotify()
     Removes the menu's peer.
synchronized  Enumerationshortcuts()
    

Field Detail
isHelpMenu
boolean isHelpMenu(Code)
This field will be set to true if the Menu in question is actually a help menu. Otherwise it will be set to false.



items
Vector items(Code)
A vector of the items that will be part of the Menu.
See Also:   Menu.countItems()



tearOff
boolean tearOff(Code)
This field indicates whether the menu has the tear of property or not. It will be set to true if the menu has the tear off property and it will be set to false if it does not. A torn off menu can be deleted by a user when it is no longer needed.
See Also:   Menu.isTearOff()




Constructor Detail
Menu
public Menu() throws HeadlessException(Code)
Constructs a new menu with an empty label. This menu is not a tear-off menu.
exception:
  HeadlessException - if GraphicsEnvironment.isHeadless()returns true.
See Also:   java.awt.GraphicsEnvironment.isHeadless
since:
   JDK1.1



Menu
public Menu(String label) throws HeadlessException(Code)
Constructs a new menu with the specified label. This menu is not a tear-off menu.
Parameters:
  label - the menu's label in the menu bar, or inanother menu of which this menu is a submenu.
exception:
  HeadlessException - if GraphicsEnvironment.isHeadless()returns true.
See Also:   java.awt.GraphicsEnvironment.isHeadless



Menu
public Menu(String label, boolean tearOff) throws HeadlessException(Code)
Constructs a new menu with the specified label, indicating whether the menu can be torn off.

Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored.
Parameters:
  label - the menu's label in the menu bar, or inanother menu of which this menu is a submenu.
Parameters:
  tearOff - if true, the menuis a tear-off menu.
exception:
  HeadlessException - if GraphicsEnvironment.isHeadless()returns true.
See Also:   java.awt.GraphicsEnvironment.isHeadless
since:
   JDK1.0.





Method Detail
add
public MenuItem add(MenuItem mi)(Code)
Adds the specified menu item to this menu. If the menu item has been part of another menu, removes it from that menu.
Parameters:
  mi - the menu item to be added the menu item added
See Also:   java.awt.Menu.insert(java.lang.Stringint)
See Also:   java.awt.Menu.insert(java.awt.MenuItemint)



add
public void add(String label)(Code)
Adds an item with the specified label to this menu.
Parameters:
  label - the text on the item
See Also:   java.awt.Menu.insert(java.lang.Stringint)
See Also:   java.awt.Menu.insert(java.awt.MenuItemint)



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



addSeparator
public void addSeparator()(Code)
Adds a separator line, or a hypen, to the menu at the current position.
See Also:   java.awt.Menu.insertSeparator(int)



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



countItems
public int countItems()(Code)



countItemsImpl
final int countItemsImpl()(Code)



deleteShortcut
void deleteShortcut(MenuShortcut s)(Code)



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



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



getItem
public MenuItem getItem(int index)(Code)
Gets the item located at the specified index of this menu.
Parameters:
  index - the position of the item to be returned. the item located at the specified index.



getItemCount
public int getItemCount()(Code)
Get the number of items in this menu. the number of items in this menu.
since:
   JDK1.1



getItemImpl
final MenuItem getItemImpl(int index)(Code)



getShortcutMenuItem
MenuItem getShortcutMenuItem(MenuShortcut s)(Code)



handleShortcut
boolean handleShortcut(KeyEvent e)(Code)



insert
public void insert(MenuItem menuitem, int index)(Code)
Inserts a menu item into this menu at the specified position.
Parameters:
  menuitem - the menu item to be inserted.
Parameters:
  index - the position at which the menuitem should be inserted.
See Also:   java.awt.Menu.add(java.lang.String)
See Also:   java.awt.Menu.add(java.awt.MenuItem)
exception:
  IllegalArgumentException - if the value ofindex is less than zero
since:
   JDK1.1



insert
public void insert(String label, int index)(Code)
Inserts a menu item with the specified label into this menu at the specified position. This is a convenience method for insert(menuItem, index).
Parameters:
  label - the text on the item
Parameters:
  index - the position at which the menu itemshould be inserted
See Also:   java.awt.Menu.add(java.lang.String)
See Also:   java.awt.Menu.add(java.awt.MenuItem)
exception:
  IllegalArgumentException - if the value ofindex is less than zero
since:
   JDK1.1



insertSeparator
public void insertSeparator(int index)(Code)
Inserts a separator at the specified position.
Parameters:
  index - the position at which themenu separator should be inserted.
exception:
  IllegalArgumentException - if the value ofindex is less than 0.
See Also:   java.awt.Menu.addSeparator
since:
   JDK1.1



isTearOff
public boolean isTearOff()(Code)
Indicates whether this menu is a tear-off menu.

Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored. true if this is a tear-off menu;false otherwise.




paramString
public String paramString()(Code)
Returns a string representing the state of this Menu. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. the parameter string of this menu



remove
public void remove(int index)(Code)
Removes the menu item at the specified index from this menu.
Parameters:
  index - the position of the item to be removed.



remove
public void remove(MenuComponent item)(Code)
Removes the specified menu item from this menu.
Parameters:
  item - the item to be removed from the menu. If item is null or is not in this menu, this method does nothing.



removeAll
public void removeAll()(Code)
Removes all items from this menu.
since:
   JDK1.0.



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



shortcuts
synchronized Enumeration shortcuts()(Code)



Fields inherited from java.awt.MenuItem
String actionCommand(Code)(Java Doc)
transient ActionListener actionListener(Code)(Java Doc)
boolean enabled(Code)(Java Doc)
long eventMask(Code)(Java Doc)
String label(Code)(Java Doc)

Methods inherited from java.awt.MenuItem
public synchronized void addActionListener(ActionListener l)(Code)(Java Doc)
public void addNotify()(Code)(Java Doc)
String constructComponentName()(Code)(Java Doc)
public void deleteShortcut()(Code)(Java Doc)
void deleteShortcut(MenuShortcut s)(Code)(Java Doc)
public synchronized void disable()(Code)(Java Doc)
final protected void disableEvents(long eventsToDisable)(Code)(Java Doc)
void doMenuEvent(long when, int modifiers)(Code)(Java Doc)
public synchronized void enable()(Code)(Java Doc)
public void enable(boolean b)(Code)(Java Doc)
final protected void enableEvents(long eventsToEnable)(Code)(Java Doc)
boolean eventEnabled(AWTEvent e)(Code)(Java Doc)
public AccessibleContext getAccessibleContext()(Code)(Java Doc)
public String getActionCommand()(Code)(Java Doc)
final String getActionCommandImpl()(Code)(Java Doc)
public synchronized ActionListener[] getActionListeners()(Code)(Java Doc)
public String getLabel()(Code)(Java Doc)
public T[] getListeners(Class<T> listenerType)(Code)(Java Doc)
public MenuShortcut getShortcut()(Code)(Java Doc)
MenuItem getShortcutMenuItem(MenuShortcut s)(Code)(Java Doc)
boolean handleShortcut(KeyEvent e)(Code)(Java Doc)
public boolean isEnabled()(Code)(Java Doc)
public String paramString()(Code)(Java Doc)
protected void processActionEvent(ActionEvent e)(Code)(Java Doc)
protected void processEvent(AWTEvent e)(Code)(Java Doc)
public synchronized void removeActionListener(ActionListener l)(Code)(Java Doc)
public void setActionCommand(String command)(Code)(Java Doc)
public synchronized void setEnabled(boolean b)(Code)(Java Doc)
public synchronized void setLabel(String label)(Code)(Java Doc)
public void setShortcut(MenuShortcut s)(Code)(Java Doc)

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.