PopupMenu in Java

0
35
Spread the love
  • 25
  • 34
  • 14
  • 23
  •  
  •  
  •  
  • 12
  •  
  •  
    108
    Shares

PopupMenu in Java
PopupMenu in Java

PopupMenu in Java:

PopupMenu is the subclass of Menu class. It represents the popup menu instead of traditional dropdown or pull-down menu. Whenever user event calls it show() method it pops up.
A PopupMenu can be associated with any graphical component in the user interface. we can call add() method to associate the PopupMenu to any component.
Platforms may implement platform specific PopupMenu but since Java is a platform independent language, it implements platform indepency by calling isPopupTrigger() method defined in the MouseEvent class. If the method returns true, MouseEvent represents the platform-specific popup menu trigger event and we should be able to use show() method to pop up the Menu.
The show() method takes x,y coordinates with respect to Component.
The structure of PopupMenu is defined as:


public class java.awt.PopupMenu extends
             java.awt.Menu{
//constructors
public PopupMenu();
public PopupMenu(String label);
//methods
public synchronized void addNotify();
public void show(Component target,int x,int y);
}
 
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
  • 25
  • 34
  • 14
  • 23
  •  
  •  
  •  
  • 12
  •  
  •  
    108
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here