944,185 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 794
  • Java RSS
Oct 8th, 2009
0

printing a variable with page.drawString

Expand Post »
Is there a way to tack a variable onto the end of a print.drawString so it would show up like
Text: <variable>
Or:
Java Syntax (Toggle Plain Text)
  1. page.drawString ("Text: " object1, x, y);

Where object1 is the variable. I tried doing that, but i get an error ")" Expected on that line, i suspect that it is because anything that is expected in that first slot is expected inside of quotes.
Last edited by Superfat; Oct 8th, 2009 at 8:14 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Superfat is offline Offline
10 posts
since Jun 2008
Oct 9th, 2009
1
Re: printing a variable with page.drawString
Click to Expand / Collapse  Quote originally posted by Superfat ...
Where object1 is the variable. I tried doing that, but i get an error ")" Expected on that line, i suspect that it is because anything that is expected in that first slot is expected inside of quotes.
Incorrect. Anything in that first argument has to amount to a String, just like the javadoc says for the drawString method. So you could put "I'm a String!" + object.toString() in that slot if you wanted to. Or you could even put "I'm a String!" + object, I think.
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Oct 9th, 2009
0

php

php in used to cms project?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
tonyjaa is offline Offline
1 posts
since Oct 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: I need help with DR JAVA
Next Thread in Java Forum Timeline: i need help creating a simple game.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC