• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Moving image left or right  RSS feed

 
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.
 
Marshal
Posts: 24464
55
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:

 
Rancher
Posts: 3040
22
  • 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!