Mouse Click in Java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Mouse Click in Java

  1. #1
    Keren Guest

    Mouse Click in Java


    Is there any way to know which button mouse was clicked??
    I have two different functions for right-click and left-click.

    I know the solution in swing...but i need it as an Applet
    and we all know the problem with that.

    Thanks in advance,
    Keren


  2. #2
    panos Guest

    Re: Mouse Click in Java


    "Keren" <Keren_Fathi@packetlight.com> wrote:
    >
    >Is there any way to know which button mouse was clicked??
    >I have two different functions for right-click and left-click.
    >
    >I know the solution in swing...but i need it as an Applet
    >and we all know the problem with that.
    >
    >Thanks in advance,
    >Keren
    >


    There is.

    Try something like the following...

    public void mouseReleased(MouseEvent e) {

    if (SwingUtilities.isRightMouseButton(e))
    {
    .....
    ....
    }
    else

  3. #3
    rupesh Guest

    Re: Mouse Click in Java


    in MouseEvent either in MouseClicked or Mouse Pressed
    check
    if(isMetaData())
    l_click
    else
    r_click()



    "Keren" <Keren_Fathi@packetlight.com> wrote:
    >
    >Is there any way to know which button mouse was clicked??
    >I have two different functions for right-click and left-click.
    >
    >I know the solution in swing...but i need it as an Applet
    >and we all know the problem with that.
    >
    >Thanks in advance,
    >Keren
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center