[JAVA2D] How to make right click Action
i want to make action using right click or press.how can in mousePressed() recognize the right mouse button? waiting fo reply .. === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.
Re: [JAVA2D] How to make right click Action
If you read the JavaDocs for MouseListener MouseEvent you will find your answer much more quickly than if you send an email to this list and wait for a response. One way to do this is use the MouseEvent object (that is an argument to your mousePressed() ) and call getButton() on that MouseEvent object. This will return an int that you can compare against the constants in MouseEvent (MouseEvent.BUTTON1, MouseEvent.BUTTON2, etc) to determine which button has changed state. -Original Message- From: Discussion list for Java 2D API [mailto:[EMAIL PROTECTED]]On Behalf Of Ayman El_Gharabawy Sent: Monday, November 25, 2002 4:04 AM To: [EMAIL PROTECTED] Subject: [JAVA2D] How to make right click Action i want to make action using right click or press.how can in mousePressed() recognize the right mouse button? waiting fo reply .. == = To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help. === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.
Re: [JAVA2D] How to make right click Action
javax.swing.SwingUtilities.isRightMouseButton(MouseEvent anEvent) Returns true if the mouse event specifies the right mouse button. Hope this helps :-) regards / vijayv - Original Message - From: Ayman El_Gharabawy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 25, 2002 5:34 PM Subject: [JAVA2D] How to make right click Action i want to make action using right click or press.how can in mousePressed() recognize the right mouse button? waiting fo reply .. === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help. === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.
Re: [JAVA2D] How to make right click Action
public void mousePressed(MouseEvent e) { super.mousePressed(e); if(e.isPopupTrigger()) { // put up your popup menu popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } See http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html#popup - Original Message - From: Ayman El_Gharabawy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 25, 2002 6:04 AM Subject: [JAVA2D] How to make right click Action i want to make action using right click or press.how can in mousePressed() recognize the right mouse button? waiting fo reply .. === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help. === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.