This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Need help with one piece of code. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help with one piece of code." Watch "Need help with one piece of code." New topic
Author

Need help with one piece of code.

Mack Grill
Greenhorn

Joined: Feb 27, 2012
Posts: 29
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.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with one piece of code.
 
Similar Threads
Using arrays to randomly generate images? (applet)
Improving Graphics.
Need help understanding random loops. code inside
Improving Graphics