Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

java- ActionListener not working

  • 24-04-2009 12:42pm
    #1
    Closed Accounts Posts: 2


    Hi,

    im trying to flick through images using back and next buttons using an action listener the next button works fine but by back button won't

    heres the code: http://www.pastebin.ca/1401863

    if any one could help that would be great
    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 2,297 ✭✭✭Ri_Nollaig


    should be
    if(e.getSource().equals(next)) {
    
    } else if (e.getSource().equals(back)) {
    
    }
    


  • Registered Users, Registered Users 2 Posts: 2,297 ✭✭✭Ri_Nollaig


    just in case you didnt know or dont understand why you should use equals() . "==" compares what the variable is actually pointing to. So for primative types like int,doubles,boolean == is grand as they point to their values but for object types it would be pointing to their references rather then their content.
    Its an easy mistake to make as its still valid code.


  • Closed Accounts Posts: 2 moopylala


    thanks for that, i didnt actually know that, i changed the code it didnt seem to fix the problem.
    i called the repaint method in start and that seems to have done the trick


Advertisement