Page 3 of 3 FirstFirst 123
Results 41 to 46 of 46
Like Tree4Likes

Thread: Really stuck need help

  1. #41
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default

    how actionlistener events can be changed from the default 'after click' to 'on click'
    Can you explain the distinction?

  2. #42
    B_Tank88 is offline Member
    Join Date
    Jul 2011
    Posts
    22
    Rep Power
    0

    Default

    At the moment, the actionlistener is called when the mouse button is released. I need the action to occur when it is clicked

  3. #43
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default

    I'm still a bit confused.

    mouseClicked(MouseEvent e)
    Invoked when the mouse button has been clicked (pressed and released) on a component.

    The API doc says a click and a release happen at the same time.

    Do you mean you want to known when the mouse has been pressed?

  4. #44
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    Quote Originally Posted by B_Tank88 View Post
    At the moment, the actionlistener is called when the mouse button is released. I need the action to occur when it is clicked
    As Norm says, a click is (and always has been I think) a press and release.
    "Click on the button to do X" means the button will only do X when you press and release the mouse button when you are hovering over X.

  5. #45
    B_Tank88 is offline Member
    Join Date
    Jul 2011
    Posts
    22
    Rep Power
    0

    Default

    The actual action though in my program (volume up) occurs not when the mouse button is clicked, but when it's released. What you two said is true, but that's not what I needed.

    I found the solution was to use a mouselistener rather than an actionlistener, as this gives you more detailed mouse click events. The one I used was 'mousePressed' I believe.

  6. #46
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default

    when the mouse button is clicked, but when it's released.
    That is at the same time. See two previous posts: 43 and 44.

    Have you solved your problem now?

Page 3 of 3 FirstFirst 123

Similar Threads

  1. I'm stuck help!!!
    By nobody58 in forum Advanced Java
    Replies: 2
    Last Post: 03-18-2010, 02:52 PM
  2. Stuck in sea
    By programmer_007 in forum JDBC
    Replies: 1
    Last Post: 09-17-2009, 04:00 AM
  3. Im on my last lab!!!! And im stuck...:(
    By clanboru15 in forum New To Java
    Replies: 5
    Last Post: 03-13-2009, 01:44 AM
  4. really stuck now..
    By shongo in forum Advanced Java
    Replies: 2
    Last Post: 11-09-2008, 02:56 AM
  5. Stuck in need of help!
    By Zombie_Leg! in forum New To Java
    Replies: 1
    Last Post: 09-23-2008, 02:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •