All About Class Menu in AWT in Java

0
26
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

The menu in AWT in Java

The menu in AWT in Java:

A menu is a pull-down component of a Menu bar. A menu can optionally be a tear-off menu. A tear-off menu can remain on the screen after the mouse button has been released. The mechanism for tearing off a menu is platform dependent. Each Menu must have a label that appear in the MenuBar. Menu belongs to the MenuItem class. This can be an instance of MenuItem,a sub menu(an instance of Menu) or a checkbox(an instance of CheckboxMenuItem). The class structure is given as:


public class java.awt.Menu extends
java.awt.MenuItem implements
java.awt.MenuContainer{
//constructor
public Menu();
public Menu(String label);
public Menu(String label,boolean tearoff);
//methods:
public synchronized MenuItem add(MenuItem menu);
public void add(String label);
public void addNotify();
public void addSeparator();
public int countItems();
public int getItemCount();
public synchronized void insert(MenuItem menuItem,int index);
public void insert(String label,int index);
public void insertSeparator(int index);
public MenuItem getItem(int index);
public boolean isTearoff();
public String paramString();
public synchronized void remove(int index);
public synchronized void remove(MenuComponent item);
public synchronized void removeAll();
public void removeNotify();
}
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
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here