Mouse right click event?

Hello~~
I'm now developing a game which need to click right mouse button, but i dont know how to implement this event int mouseClicked(MouseEvent e) method. Can anyone konw how to code it ..
thank~

check out these postings and see if it helps.
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=571926
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=546064

Similar Messages

  • How can i disable mouse right clicking event

    I need in my project to disallow any body to right click the mouse. Can i disable this event to prevent user of the application from right clicking if yes how can i disable it.

    I have code written in Visual Basic doing the same task but i don't know how to transfer those code in java
    The following is a code for that:
    Option Explicit
    'declares
    Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
    Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
    Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
    'constant
    Private Const WH_MOUSE_LL = 14&
    Public Const HC_ACTION = 0&
    Public Const WM_RBUTTONDOWN = &H204
    Public Const WM_RBUTTONUP = &H205
    Public Const VK_RBUTTON = &H2
    Private lMShook As Long
    Private bHookEnabled As Boolean
    'functions which process mouse events
    Public Function MouseProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    If nCode = HC_ACTION Then
    If (wParam = WM_RBUTTONUP Or wParam = WM_RBUTTONDOWN) Then
    MouseProc = 1
    Exit Function
    End If
    End If
    MouseProc = CallNextHookEx(lMShook, nCode, wParam, lParam)
    End Function
    Public Function SetHook()
    If lMShook = 0 Then
    lMShook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf MouseProc, App.hInstance, 0&)
    End If
    If lMShook = 0 Then
    MsgBox "failed to install hook :" & lMShook & " : " & WH_MOUSE_LL
    bHookEnabled = False
    Unload Form1
    Exit Function
    Else
    bHookEnabled = True
    End If
    End Function
    Public Function UnSetHook()
    If bHookEnabled Then
    Call UnhookWindowsHookEx(lMShook)
    lMShook = 0
    End If
    bHookEnabled = False
    End Function
    Public Function InstalledHook()
    MsgBox " installed hook is :" & lMShook
    End Function
    code for form is below:
    Option Explicit
    Private Sub Command1_Click()
    InstalledHook
    End Sub
    Private Sub Command2_Click()
    Call SetHook
    End Sub
    Private Sub Command3_Click()
    Call UnSetHook
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
    Call UnSetHook
    End Sub

  • Robot mouseClick with mouse right click

    I try to capture mouse right click and fire mouse right click event in robot.mousePress or mouseRelease.
    does anybody know how to do this?
    Thanks.

    rocketlad
    Welcome to the forum. Please don't post in threads that are long dead. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
    I'm locking this thread now.
    db

  • How to activate mouse right click in JTexhArea

    Hi Swings Expert!
    I've a problem to get action mouse right click in JTextArea for example to cut and paste selected text from textarea into another textarea.
    If I want to copy and paste text from textarea, Ive to use Ctrl C for copy
    and Ctrl V for paste the selected text.
    Is there a way to activate mouse right click in JTextArea?
    any help.....Thanks a lot.

    Here are the basics:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class PopupMenuTest extends JFrame implements MouseListener
         public JPopupMenu popup;
         public PopupMenuTest()
              popup = new JPopupMenu();
    //          popup.add( new DefaultEditorKit.CutAction() );
              JMenuItem item = new JMenuItem( new DefaultEditorKit.CutAction() );
              item.setMnemonic('C');
              popup.add( item );
              popup.add( new DefaultEditorKit.CopyAction() );
              popup.add( new DefaultEditorKit.PasteAction() );
              JTextField textField = new JTextField("Right Click For Popup");
              textField.addMouseListener( this );
              getContentPane().add(textField);
         private void checkForPopup(MouseEvent e)
              if (e.isPopupTrigger())
                   popup.show(e.getComponent(), e.getX(), e.getY());
         public void mousePressed(MouseEvent e)
              checkForPopup( e );
         public void mouseReleased(MouseEvent e)
              checkForPopup( e );
         public void mouseClicked(MouseEvent e) {}
         public void mouseEntered(MouseEvent e) {}
         public void mouseExited(MouseEvent e) {}
         public static void main(String[] args)
              PopupMenuTest frame = new PopupMenuTest();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.show();
    }

  • Magic mouse right click problem in Mountain Lion

    Hi!
    My Magic mouse right-click doesn't work in Mountain Lion! in previous OSes it was working properly (Leopard and Lion), but when I upgrated to Mountain, this problem occured.
    if you click anywhere on the magic mouse, it simply do a click, not a right-click anyway...
    I did a lot of searches and changes but the problem is still alive...
    somewhere suggested disabling "Secondary Click", then restart, and then enabling it. but nothing changed...
    somewhere suggested to remove two files named "com.apple.Bluetooth..." in /Library/Preferences, and then restart the system, but this not worked for me, too...
    I changed the "Secondary Click" to "Click on the left side" but nothing changed and the magic mouse did just clicking and not right-clicking!
    I wondered what can I really do to solve this problem?!
    any suggestion is appreciated...

    I still use the magic-mouse and still it's not stable. I've found theONLY way to overcome the rightclick is to make sure that you're NOT pressing anywhere else on the mouse (even touching) and only pressing at theTOP right-hand most corner.
    It's not the best resolution, but the best that Applecare could provide me with. I thinjk, because it's relatively new due to the new generation of capacitive touch devices that we all get the bugs/flaws.
    As like the iPhone, although an EXCELLENT device, and the various versions of OSX, we're going to be plagued eith bugs until a newer review comes out.
    The way I found out was to use BOTH tools (MagicPrefs and BetterTouchTool) together, and in both set the Rightclick sensitive area to a near nothing for system wide (non app specific).
    It does fail at times on some apps, and takes a few clicks, but 90% of the time it's cleared up.
    I somehow think that most developers (and yes its the developers not apple) that forget that we rest out palms on the mouse) and they don't filter out the events forrectly (i.e. a palm on the mouse is seen as a tap). Othere works well, for exmaple I use photoshop, which adapted well to the mouse. The majority of games, and including those (ESPECUALLY THOSE) flash mbased, don't like the mouse at all!

  • Why keyboard and mouse right click not working in Solaris and Linux?

    Hi all,
    I have two problems:
    1) I am working on AWT/Swing application and its working fine in window enviornment,but while running on solaris and linux mouse right-click option window not poping up.
    2) Ctrl+c,Ctrl+v,Home and End keyboard key are not working in solaris and linux OS for same application.
    Pls provide me some solution for these problem.
    -Dinesh

    Hi Nik,
    Thanks for reply. I found some solution for the above problem.
    For mouse right click there was problem in my source code.I have not implemented the mousePressed() method
    In case of keyboard Home, End and arrow key working fine after exporting AWTUSE_TYPE4_PATCH=false; in solaris and linux
    But still Ctrl-c and Ctrl-v not working.
    I am using JDK1.5.0_07+Eclipse IDE 3.1
    -Dinesh

  • Mouse right-click function doesn't work in Bookmarks (Mac)

    I recently switched from PCs to Macs. No problem downloading Firefox and transferring old bookmarks and other settings, with one exception. With the PCs, when I right-clicked a particular bookmark under Bookmarks I got a series of 12 options (from Open, Open in New Window to Delete, Sort by Name, Properties). I used these a lot to delete bookmarks, change names, alphabetize lists, etc. I can now do most of these things under the Manage Bookmarks setting, but when I right click bookmarks now the new bookmark I click on just replaces the one on screen (ie, the right click does exactly what the left click does). I am using two different mice (Apple Mighty Mouse with Leopard, Microsoft Wheel Mouse with Tiger) and the right click function behaves as expected in other programs. Are these mouse right click Bookmark functions supposed to appear with the Firefox for Mac? If so, any ideas how to resolve my problem?

    Can someone explain to me why it's possible in Chrome on Mac, but not on Firefox? This is my 2nd biggest complaint about FF on the Mac, only surpassed by missing favicons in bookmarks. Chrome does both very well.

  • Mouse right click on the field of the ALV Table

    Hi Experts,
    I have a requirement where i want to show some pop up to user once he does right click on one of the field of ALV table.
    Can u plz tell me how i can do this.
    Thanks
    Mahesh

    Hi.,
    In WDA there are no such event I think.,
    check this thread : Right click event on dynamic alv
    hope this helps u.
    Thanks & Regards,
    Kiran

  • CommandLink on mouse right click!!!

    Hi all,
    I have a problem in CommandLink,when i use mouse right click open in new tab or open in new window over the CommandLink it shows a previous page instead of actual page.I tried to overcome this using <redirect/> tag in faces-config xml but its a vain eventually.
    No request is generated to server while trying open in new tab.
    Any of u ever had this issue,any suggestions???.
    Awaiting reply.
    Thanks in advance,
    sundar.

    sundar82 wrote:
    Hi all,
    I have a problem in CommandLink,when i use mouse right click open in new tab or open in new window over the CommandLink it shows a previous page instead of actual page.I tried to overcome this using <redirect/> tag in faces-config xml but its a vain eventually.
    No request is generated to server while trying open in new tab.Which browser are you using?

  • My iMac mouse right click does not work now

    Hi all,
    My iMac mouse right click does not work now.  It was fine a couple of days ago. 
    Right click is definitely enabled, I have checked it several times.
    A Google search revealed that in Firefox it could be that I'm not using the latest version of Firebug.  I have auto updates on and Firebug is the latest version 1.11.3
    I use right click for correcting spell checked words, instead of a suggested correct spelling I get the 'open in a new tab' menu.
    In Firefox when I right click to open in a new tab I get the menu but it does nothing.
    It is driving me mad
    Any help will be greatly appreciated,
    Thank you
    P.S. thought it was suddenly working when I did the spell check in this post but it was the left click doign it....

    I don't use Firefox so I can't test it, but it might be something to do with a preference setting. Have a look at this link (ignore all the instructions), just look at the image of the preferences, there appears to be a setting in Javascript preferences relating to contextual menus. Check to see what your settings are:
    http://stackoverflow.com/questions/16377381/disable-firefoxs-silly-right-click-c ontext-menu

  • Thunderbird Crashes on selection +"ctrl+c" or mouse right click

    Whenever I attempt to copy text from within a mail message, by selecting text & pressing ctrl+C TB crashes,
    or Just on Mouse Right Click TB Crashes

    So, I finally did a fresh install of OSX on iMac, and the right click came back.
    I think there was something corrupted on the system that somehow showed up after Adobe CS2. I reinstalled CS2 but up to now, no problems at all.
    Thanks all for the insights, they all helped a lot!

  • I HAVE IMAC 27 INCH MY MOUSE RIGHT CLICK IS NOT WORKING PROPERLY .ANY ONE HAVE HIS PROBLEM

    I HAVE IMAC 27 INCH MY MOUSE RIGHT CLICK IS NOT WORKING PROPERLY .ANY ONE HAVE THIS PROBLEM

    Have you tried going to System Preferences>Mouse and making sure that right click is set to secondary click?

  • Apple mouse right click function stopped working

    After 4 and a half years my Apple mouse right click function on my iMac stopped working.  However the mouse works perfectly on my other iMac.  The apple store said the problem is in the iMac.  Any ideas how to fix this?
    Thanks, jpm3577

    First log into another user account on your Mac and see if it work correctly there.  If not boot into Safe Mode, Mac OS X: Starting up in Safe Mode, and try there.  Also try another USB port on the Mac if it's a wired mouse.

  • Disable Mouse Right click inside Adobe Acrobat PDF plugin

    Hi All,
    We are rendering Adobe live cycle pdf file inside html object tag.
    I have disabled toolbar , navigation bar using navpanes=0&toolbar=0.
    But when mouse right click reenable the context menu again.
    So Is there any way to disable mouse righ click inside Adobe Acrobat PDF browser plugin?

    I had the same problem after updating Firefox to version 4.0 and Acrobat Reader to Version X. For me (Win XP) what solve the problem was deleting the Acrobat Reader Plugin (nppdf32.dll) in the Firefox plugin folder (C:\Program Files\Mozilla Firefox\plugins). So now there is only one Acrobat Reader Plugin left namely the one in the Acrobat Reader plugin folder (C:\Program Files\Adobe\Reader 10.0\Reader\Browser).

  • Mouse Right Click

    Hello all,
    How to track mouse right click in Oracle Forms? I have a form which has a popup menu, based on the item status i have to enable and disable some options in the popup menu. Any ideas?
    With Regards,
    Yathish

    try the PRE-POPUP-MENU - trigger

Maybe you are looking for