MenuBar in Java


MenuBar in Java
MenuBar in Java

MenuBar in Java:

MenuBar encapsulates the platform's concept of a menu bar bound to a Frame. So this class represents a menu bar. We can use add() that adds Menu objects to the MenuBar.
setHelpMenu() adds a Help menu in the menu bar. In order to attach the menu bar to a frame, the setMenuBar() method in the class Frame must be called.

The structure of the MenuBar class is given as:


public class java.awt.MenuBar extends 
             java.awt.MenuComponent implements
             java.awt.MenuContainer{
//constrcutor:
public MenuBar();
//methods:
public synchronized Menu add(Menu menu);
public void addNotify();
public void deleteShortcut(MenuShortCut shortcut)
public int countMenus();
public Menu getHelpMenu();
public int getMenuCount();
public MenuItem getShortcutMenuItem(MenuShortcut shortcut);
public Menu getMenu(int i);
public synchronized void remove(int index);
public synchronized void remove(MenuComponent m);
public void removeNotify();
public synchronized void setHelpMenu(Menu m);
public synchronized Enumeration shortcuts();
}
             
 
MenuBar in Java MenuBar in Java Reviewed by Animesh Chatterjee on January 14, 2019 Rating: 5

No comments:

Powered by Blogger.