This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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