File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes drawString Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "drawString Question" Watch "drawString Question" New topic

drawString Question

Jacob H

Joined: Oct 03, 2003
Posts: 9
I have the following line:
g.drawString(((Employee)firstList.get(i)).getEmpNumber(), 80, 80+(i*15));
It returns an Int (for EmpNumber) but of course drawString needs a String.
How do I convert it to string?
I tried this
toString ( ((Employee)firstList.get(i)).getEmpNumber() ) but that didnt work.

Any help is appreciated.
Vikalp Setya

Joined: May 10, 2003
Posts: 18

You can use String.valueOf(...) to convert the argument to String. Do this..
g.drawString(String.valueOf(((Employee)firstList.get(i)).getEmpNumber()), 80, 80+(i*15));

Regards,<br />vikalps
Jacob H

Joined: Oct 03, 2003
Posts: 9
I agree. Here's the link:
subject: drawString Question
It's not a secret anymore!