Java Doc for MenuItem.java in  » 6.0-JDK-Modules » j2me » java » awt » 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 » 6.0 JDK Modules » j2me » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.MenuComponent
      java.awt.MenuItem

All known Subclasses:   java.awt.CheckboxMenuItem,  java.awt.Menu,
MenuItem
public class MenuItem extends MenuComponent (Code)
All items in a menu must belong to the class MenuItem, or one of its subclasses.

The default MenuItem object embodies a simple labeled menu item.

This picture of a menu bar shows five menu items:
The first two items are simple menu items, labeled "Basic" and "Simple". Following these two items is a separator, which is itself a menu item, created with the label "-". Next is an instance of CheckboxMenuItem labeled "Check". The final menu item is a submenu labeled "More Examples", and this submenu is an instance of Menu.

When a menu item is selected, AWT sends an action event to the menu item. Since the event is an instance of ActionEvent, the processEvent method examines the event and passes it along to processActionEvent. The latter method redirects the event to any ActionListener objects that have registered an interest in action events generated by this menu item.

Note that the subclass Menu overrides this behavior and does not send any event to the frame until one of its subitems is selected.
version:
   1.50, 08/10/01
author:
   Sami Shaio



Field Summary
 StringactionCommand
    
transient  ActionListeneractionListener
    
 booleanenabled
    
 longeventMask
    
 Stringlabel
    

Constructor Summary
public  MenuItem()
     Constructs a new MenuItem with an empty label and no keyboard shortcut.
public  MenuItem(String label)
     Constructs a new MenuItem with the specified label and no keyboard shortcut.
public  MenuItem(String label, MenuShortcut s)
     Create a menu item with an associated keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items.

Method Summary
public synchronized  voidaddActionListener(ActionListener l)
     Adds the specified action listener to receive action events from this menu item.
public  voidaddNotify()
     Creates the menu item's peer.
 StringconstructComponentName()
     Construct a name for this MenuComponent.
public  voiddeleteShortcut()
     Delete any MenuShortcut object associated with this menu item.
 voiddeleteShortcut(MenuShortcut s)
    
public synchronized  voiddisable()
    
final protected  voiddisableEvents(long eventsToDisable)
     Disables event delivery to this menu item for events defined by the specified event mask parameter.
 voiddoMenuEvent()
    
public synchronized  voidenable()
    
public  voidenable(boolean b)
    
final protected  voidenableEvents(long eventsToEnable)
     Enables event delivery to this menu item for events to be defined by the specified event mask parameter

Since event types are automatically enabled when a listener for that type is added to the menu item, this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.

 booleaneventEnabled(AWTEvent e)
    
public  StringgetActionCommand()
     Gets the command name of the action event that is fired by this menu item.
public synchronized  ActionListener[]getActionListeners()
     Returns an array of all the action listeners registered on this menu item.
public  StringgetLabel()
     Gets the label for this menu item.
public  MenuShortcutgetShortcut()
    
 MenuItemgetShortcutMenuItem(MenuShortcut s)
    
 booleanhandleShortcut(KeyEvent e)
    
public  booleanisEnabled()
     Checks whether this menu item is enabled.
public  StringparamString()
     Returns the parameter string representing the state of this menu item.
protected  voidprocessActionEvent(ActionEvent e)
     Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects. This method is not called unless action events are enabled for this component.
protected  voidprocessEvent(AWTEvent e)
     Processes events on this menu item.
public synchronized  voidremoveActionListener(ActionListener l)
     Removes the specified action listener so it no longer receives action events from this menu item.
public  voidsetActionCommand(String command)
     Sets the command name of the action event that is fired by this menu item.
public synchronized  voidsetEnabled(boolean b)
     Sets whether or not this menu item can be chosen.
public synchronized  voidsetLabel(String label)
     Sets the label for this menu item to the specified label.
public  voidsetShortcut(MenuShortcut s)
     Set the MenuShortcut object associated with this menu item.

Field Detail
actionCommand
String actionCommand(Code)



actionListener
transient ActionListener actionListener(Code)



enabled
boolean enabled(Code)



eventMask
long eventMask(Code)



label
String label(Code)




Constructor Detail
MenuItem
public MenuItem()(Code)
Constructs a new MenuItem with an empty label and no keyboard shortcut.
since:
   JDK1.1



MenuItem
public MenuItem(String label)(Code)
Constructs a new MenuItem with the specified label and no keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items. By default, all menu items except for separators are enabled.
Parameters:
  label - the label for this menu item.
since:
   JDK1.0



MenuItem
public MenuItem(String label, MenuShortcut s)(Code)
Create a menu item with an associated keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items. By default, all menu items except for separators are enabled.
Parameters:
  label - the label for this menu item.
Parameters:
  s - the instance of MenuShortcutassociated with this menu item.
since:
   JDK1.1




Method Detail
addActionListener
public synchronized void addActionListener(ActionListener l)(Code)
Adds the specified action listener to receive action events from this menu item.
Parameters:
  l - the action listener.
See Also:   java.awt.event.ActionEvent
See Also:   java.awt.event.ActionListener
See Also:   java.awt.MenuItem.removeActionListener
since:
   JDK1.1



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



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



deleteShortcut
public void deleteShortcut()(Code)
Delete any MenuShortcut object associated with this menu item.
since:
   JDK1.1



deleteShortcut
void deleteShortcut(MenuShortcut s)(Code)



disable
public synchronized void disable()(Code)



disableEvents
final protected void disableEvents(long eventsToDisable)(Code)
Disables event delivery to this menu item for events defined by the specified event mask parameter.
Parameters:
  eventsToDisable - the event mask defining the event types.
See Also:   java.awt.MenuItem.processEvent
See Also:   java.awt.MenuItem.enableEvents
See Also:   java.awt.Component.disableEvents
since:
   JDK1.1



doMenuEvent
void doMenuEvent()(Code)



enable
public synchronized void enable()(Code)



enable
public void enable(boolean b)(Code)



enableEvents
final protected void enableEvents(long eventsToEnable)(Code)
Enables event delivery to this menu item for events to be defined by the specified event mask parameter

Since event types are automatically enabled when a listener for that type is added to the menu item, this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.
Parameters:
  eventsToEnable - the event mask defining the event types.
See Also:   java.awt.MenuItem.processEvent
See Also:   java.awt.MenuItem.disableEvents
See Also:   java.awt.Component.enableEvents
since:
   JDK1.1




eventEnabled
boolean eventEnabled(AWTEvent e)(Code)



getActionCommand
public String getActionCommand()(Code)
Gets the command name of the action event that is fired by this menu item.
See Also:   java.awt.MenuItem.setActionCommand
since:
   JDK1.1



getActionListeners
public synchronized ActionListener[] getActionListeners()(Code)
Returns an array of all the action listeners registered on this menu item. all of this menu item's ActionListenersor an empty array if no actionlisteners are currently registered
See Also:   MenuItem.addActionListener
See Also:   MenuItem.removeActionListener
See Also:   java.awt.event.ActionEvent
See Also:   java.awt.event.ActionListener
since:
   1.4



getLabel
public String getLabel()(Code)
Gets the label for this menu item. the label of this menu item, or nullif this menu item has no label.
See Also:   java.awt.MenuItem.setLabel
since:
   JDK1.0



getShortcut
public MenuShortcut getShortcut()(Code)
Get the MenuShortcut object associated with this menu item, the menu shortcut associated with this menu item,or null if none has been specified.
See Also:   java.awt.MenuItem.setShortcut
since:
   JDK1.1



getShortcutMenuItem
MenuItem getShortcutMenuItem(MenuShortcut s)(Code)



handleShortcut
boolean handleShortcut(KeyEvent e)(Code)



isEnabled
public boolean isEnabled()(Code)
Checks whether this menu item is enabled.
See Also:   java.awt.MenuItem.setEnabled
since:
   JDK1.0



paramString
public String paramString()(Code)
Returns the parameter string representing the state of this menu item. This string is useful for debugging. the parameter string of this menu item.
since:
   JDK1.0



processActionEvent
protected void processActionEvent(ActionEvent e)(Code)
Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects. This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

  • An ActionListener object is registered via addActionListener.
  • Action events are enabled via enableEvents.

Parameters:
  e - the action event.
See Also:   java.awt.event.ActionEvent
See Also:   java.awt.event.ActionListener
See Also:   java.awt.MenuItem.enableEvents
since:
   JDK1.1



processEvent
protected void processEvent(AWTEvent e)(Code)
Processes events on this menu item. If the event is an instance of ActionEvent, it invokes processActionEvent, another method defined by MenuItem.

Currently, menu items only support action events.
Parameters:
  e - the event.
See Also:   java.awt.MenuItem.processActionEvent
since:
   JDK1.1




removeActionListener
public synchronized void removeActionListener(ActionListener l)(Code)
Removes the specified action listener so it no longer receives action events from this menu item.
Parameters:
  l - the action listener.
See Also:   java.awt.event.ActionEvent
See Also:   java.awt.event.ActionListener
See Also:   java.awt.MenuItem.addActionListener
since:
   JDK1.1



setActionCommand
public void setActionCommand(String command)(Code)
Sets the command name of the action event that is fired by this menu item.

By default, the action command is set to the label of the menu item.
Parameters:
  command - the action command to be setfor this menu item.
See Also:   java.awt.MenuItem.getActionCommand
since:
   JDK1.1




setEnabled
public synchronized void setEnabled(boolean b)(Code)
Sets whether or not this menu item can be chosen.
Parameters:
  b - if true, enables this menu item;if false, disables it.
See Also:   java.awt.MenuItem.isEnabled
since:
   JDK1.1



setLabel
public synchronized void setLabel(String label)(Code)
Sets the label for this menu item to the specified label.
Parameters:
  label - the new label, or null for no label.
See Also:   java.awt.MenuItem.getLabel
since:
   JDK1.0



setShortcut
public void setShortcut(MenuShortcut s)(Code)
Set the MenuShortcut object associated with this menu item. If a menu shortcut is already associated with this menu item, it is replaced.
Parameters:
  s - the menu shortcut to associatewith this menu item.
See Also:   java.awt.MenuItem.getShortcut
since:
   JDK1.1



Fields inherited from java.awt.MenuComponent
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)
public Font getFont()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public MenuContainer getParent()(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
public boolean equals(Object obj)(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.