my dog learned polymorphism*
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
Author

drawString Question

Jacob H
Greenhorn

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
Greenhorn

Joined: May 10, 2003
Posts: 18
Hi,

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
Greenhorn

Joined: Oct 03, 2003
Posts: 9
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: drawString Question
 
Similar Threads
equals() to check equality of two objects
Wanted: Java2D example of zooming and panning with scroll bars
accessing jsp array variable in javascript
Problem on drawing on panel
please check this code