View Single Post
  #2 (permalink)  
Old 01-31-2008, 12:02 AM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Welcome!
Welcome, geork, to Java Forums!

First, you must declare the integer, num, and then you can use it like this:
Code:
int num = 10; JLabel label = new JLabel((new Integer(num)).toString());
I do this, because this construction is expecting an argument of type String. To convert the number into a String, you can create a new Integer object and then use its toString() method.

Hope this helped.
__________________
If your ship has not come in yet then build a lighthouse.

Last edited by tim : 01-31-2008 at 09:43 PM. Reason: For some reason I keep typing "the" instead of "to" :D
Reply With Quote