Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Development
java- ActionListener not working
moopylala
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
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
Ri_Nollaig
should be
if(e.getSource().equals(next)) { } else if (e.getSource().equals(back)) { }
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.
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