MenuBar in Java

0
20
Spread the love
  • 13
  • 34
  • 14
  • 12
  •  
  •  
  •  
  • 12
  •  
  •  
    85
    Shares

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();
}
             
 
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 13
  • 34
  • 14
  • 12
  •  
  •  
  •  
  • 12
  •  
  •  
    85
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here