This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Popup menu" Watch "Popup menu" New topic

Popup menu


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();

popcut = new JMenuItem(" Cut ");
popcut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK));
cp.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me)
if (me.isPopupTrigger())
int x = me.getX(), y = me.getY(); me.getComponent(), x, y);
I agree. Here's the link:
subject: Popup menu
It's not a secret anymore!