wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Popup menu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Popup menu" Watch "Popup menu" New topic
Author

Popup menu

vandana
Greenhorn

Joined: Mar 29, 2001
Posts: 13
namaste gurus,
will any one thr help me out???
i hv attached a pop up menu to my JDialog. the prob whch i am facing is tht even wthout right click, just by left clk of the mouse the menu pops up!
its strange!
i am givg a snippet of my code for better understanding....
cp is object of Container i;e getContentPane().

pop = new JPopupMenu();

//pop.setLightWeightPopupEnabled(false)
popcut = new JMenuItem(" Cut ");
popcut.setMnemonic(KeyEvent.VK_C);
popcut.setOpaque(true);
popcut.setForeground(Color.black);
popcut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK));
popcut.addActionListener(this);
pop.add(popcut);
cp.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me)
{
if (me.isPopupTrigger())
{
int x = me.getX(), y = me.getY();
pop.show( me.getComponent(), x, y);
}
}
});
thanx
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Popup menu
 
Similar Threads
how to compare the values in arrays
Menu question
PopupMenu
pop up menu
How to put menu item in Title bar