• Post Reply Bookmark Topic Watch Topic
  • New Topic

Moving image left or right  RSS feed

 
Ryan Daguman
Ranch Hand
Posts: 33
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me! I've been going nuts on this! I can't find any resource on the net about a simple Java code just to move a gif image left or right. I've already accomplished the up, down, and center and they're working fine, thus, I'm still struggling with moving the image left or right. Here's the code.



I remember in Visual BASIC it's easily achieved by NameOfImage.left = NameOfImage.left - 10 to move left and NameOfImage.left = NameOfImage.left + 10. Please help me with this. Thank you.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Don't use the == operator to compare the contents of two strings. Use the equals() method instead:

 
Rob Camick
Ranch Hand
Posts: 2756
12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


You are missing the brackets to indicate a block of code so the "left =50" statatement is always executed.

The code should be:


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!