This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drawString Question

 
Jacob H
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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));
 
Jacob H
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic