Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HELP! URGENT!  RSS feed

 
Steffen Durale
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there
i want to drag and drop with the right mousebutton und the jpopup menu should popup by pressing the left mousebutton.
i have included a mouse listener to my jtable
public class TableMouseListener implements MouseListener {
GenTable ivView;
public TableMouseListener(GenTable view) {
this.ivView = view;
}
public void mouseClicked(MouseEvent e) {
if(e.getClickCount() ==1) {
ivView.ivPopupMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {
}
}
but now the popup menu pops up by pressing the right and the left mousebutton... how do I force the mouselistener that the popup menu pops up only by pressing the left mouse button.
please can you help me with the drag and drop and the right mouse button... thanx in advance
regards
Steffen
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steffen,
Try the following lines inside your mouseClicked method

Regards,
Manfred.
 
Steffen Durale
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx Manfred for your reply,
it works like you posted it... (thanx again!)
but I havent figured out the drag and drop with the right mousebutton...
do anybody have any ideas??
regards Steffen
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!