Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

drawString Question  RSS feed

 
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!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!