printing a variable with page.drawString

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2008
Posts: 10
Reputation: Superfat is an unknown quantity at this point 
Solved Threads: 0
Superfat Superfat is offline Offline
Newbie Poster

printing a variable with page.drawString

 
0
  #1
Oct 8th, 2009
Is there a way to tack a variable onto the end of a print.drawString so it would show up like
Text: <variable>
Or:
  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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,658
Reputation: BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold 
Solved Threads: 206
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso
 
1
  #2
Oct 9th, 2009
Originally Posted by Superfat View Post
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.
Out.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: tonyjaa is an unknown quantity at this point 
Solved Threads: 1
tonyjaa tonyjaa is offline Offline
Newbie Poster

php

 
0
  #3
Oct 9th, 2009
php in used to cms project?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 293 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC