0

Is there a way to tack a variable onto the end of a print.drawString so it would show up like
Text: <variable>
Or:

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.

Edited by Superfat: n/a

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by tonyjaa
1

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.