Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Need help with one piece of code.

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm making an applet that randomly displays three images with a string of text on one of the images.

The problem I'm having is trying to get the string of text just to appear on a specific image.

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see a few problems:

In line 12 you are creating a new local variable called message that isn't used. You probably wanted to set the member variable declared in line 6 to some message. If that's the case, change line 12 to:

Without the type String in front of it, because that means you're declaring a new variable instead of setting the existing member variable.

In line 21 you're drawing the empty string "". You probably meant to draw the message there instead:

 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic