Win a copy of Learn Spring Security (video course) this week in the Spring 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