| | |
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:
Solved Threads: 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:
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.
Text: <variable>
Or:
Java Syntax (Toggle Plain Text)
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.
•
•
Join Date: Sep 2008
Posts: 1,658
Reputation:
Solved Threads: 206
1
#2 Oct 9th, 2009
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.
![]() |
Similar Threads
- Printing a web page from asp.net (VB.NET)
- Passing a variable to another page (ASP.NET)
- problem ragarding printing a jsp page (JSP)
- Lexmark printer Z53 stops printing in middle of page (OS X)
- Preventing URL's from printing to the bottom of a page printed from a website. (Geeks' Lounge)
- No page header and footer when printing a web page (JavaScript / DHTML / AJAX)
- Printing Web Page (Windows 95 / 98 / Me)
Other Threads in the Java Forum
- Previous Thread: I need help with DR JAVA
- Next Thread: i need help creating a simple game.
Views: 293 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint android animated api apple applet application arguments array arrays automation binary blackberry block bluetooth chat class classes client code component database detection developmenthelp draw eclipse encode error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer iphone j2me j2seprojects java javac javaprojects jmf jni jpanel julia lego linux list loop loops mac map method methods mobile netbeans newbie number object online oracle os page print problem program programming project recursion scanner screen server set singleton size sms socket sort sql string swing template test textfields threads time title transfer tree tutorial-sample update windows working






