What is menu bar in java

What is menu bar in java

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, shortcuts() and getShortcutMenuItem(java.awt.MenuShortcut) that retrieve information about the shortcuts a given menu bar is managing.

Читайте также:  Объект внутри объекта php

Nested Class Summary

Nested classes/interfaces inherited from class java.awt.MenuComponent

Constructor Summary

Method Summary

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.

Methods inherited from class java.awt.MenuComponent

Methods inherited from class java.lang.Object

Methods inherited from interface java.awt.MenuContainer

Constructor Detail

Method Detail

addNotify

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.

removeNotify

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.

getHelpMenu

setHelpMenu

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.

add

Adds the specified menu to the menu bar. If the menu has been part of another menu bar, removes it from that menu bar.

remove

public void remove(int index)

remove

getMenuCount

countMenus

getMenu

shortcuts

getShortcutMenuItem

public MenuItem getShortcutMenuItem(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.

deleteShortcut

getAccessibleContext

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.

Читайте также:  text-align

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2023, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

Источник

Class MenuBar

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, shortcuts() and getShortcutMenuItem(java.awt.MenuShortcut) that retrieve information about the shortcuts a given menu bar is managing.

Nested Class Summary

Nested classes/interfaces declared in class java.awt.MenuComponent

Constructor Summary

Method Summary

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.

Methods declared in class java.awt.MenuComponent

Methods declared in class java.lang.Object

Methods declared in interface java.awt.MenuContainer

Constructor Details

Method Details

addNotify

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.

removeNotify

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.

getHelpMenu

setHelpMenu

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.

add

Adds the specified menu to the menu bar. If the menu has been part of another menu bar, removes it from that menu bar.

remove

remove

getMenuCount

countMenus

getMenu

shortcuts

getShortcutMenuItem

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.

deleteShortcut

getAccessibleContext

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.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

What is menu bar in java

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, shortcuts() and getShortcutMenuItem(java.awt.MenuShortcut) that retrieve information about the shortcuts a given menu bar is managing.

Nested Class Summary

Nested classes/interfaces declared in class java.awt.MenuComponent

Constructor Summary

Method Summary

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.

Methods declared in class java.awt.MenuComponent

Methods declared in class java.lang.Object

Methods declared in interface java.awt.MenuContainer

Constructor Detail

Method Detail

addNotify

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.

removeNotify

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.

getHelpMenu

setHelpMenu

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.

add

Adds the specified menu to the menu bar. If the menu has been part of another menu bar, removes it from that menu bar.

remove

public void remove​(int index)

remove

getMenuCount

countMenus

getMenu

shortcuts

getShortcutMenuItem

public MenuItem getShortcutMenuItem​(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.

deleteShortcut

getAccessibleContext

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.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Оцените статью